Discussion:
[PHP-INSTALL] Questions regarding limits of processes launched by system, exec, passthru ...
Valentin Schmid - ICSurselva AG
2008-09-25 08:39:03 UTC
Permalink
Hello all,

Is there a way to limit the memory consumption and / or the CPU
consumption of processes launched by the php functions system,
exec, passthru, proc_open and shell_exec?

We use mod_php with an apache (mpm-prefork) on Linux.

The following settings don't have any effect at all:
PHP:
max_execution_time 30
memory_limit 8M
Apache:
RLimitCPU 30 30
RLimitMEM 8388608 8388608

The limits above do have effect on php-scripts (without system calls)
and on CGIs (as well on processes launched by CGIs).

Any Ideas?

Kind Regards
valli


PS: I tested it with the following two scripts:
system_memorytest.php
=====================
<html>
<head>
<title>php-systemcall-memory test</title>
</head>
<body>
php-systemcall-memory test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$s = "teststr_";
while (1) {
print "len=".length($s)."<br>\n";
sleep(1);
$s .= $s;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>


system_timeouttest.php
======================
<html>
<head>
<title>php-systemcall-timeout test</title>
</head>
<body>
php-systemcall-timeout test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$i = 0;
while (1) {
if (($i % 10000000) == 0) {
print "i=".$i."<br>\n";
}
$i += 1;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>
Keith Roberts
2008-09-25 11:31:42 UTC
Permalink
Subject: [PHP-INSTALL] Questions regarding limits of processes launched by
system, exec, passthru ...
Hello all,
Is there a way to limit the memory consumption and / or the CPU
consumption of processes launched by the php functions system,
exec, passthru, proc_open and shell_exec?
We use mod_php with an apache (mpm-prefork) on Linux.
max_execution_time 30
memory_limit 8M
RLimitCPU 30 30
RLimitMEM 8388608 8388608
The limits above do have effect on php-scripts (without system calls)
and on CGIs (as well on processes launched by CGIs).
Any Ideas?
Kind Regards
valli
system_memorytest.php
=====================
<html>
<head>
<title>php-systemcall-memory test</title>
</head>
<body>
php-systemcall-memory test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$s = "teststr_";
while (1) {
print "len=".length($s)."<br>\n";
sleep(1);
$s .= $s;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>
system_timeouttest.php
======================
<html>
<head>
<title>php-systemcall-timeout test</title>
</head>
<body>
php-systemcall-timeout test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$i = 0;
while (1) {
if (($i % 10000000) == 0) {
print "i=".$i."<br>\n";
}
$i += 1;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>
What OS are you running? If it's Unix/Linux then you might
be able to control these settings with ulimit.

Please see the manual page for ulimit for details.

'pinfo' is a lynx-style info page browser that I find
very usefull for browsing info manual pages on Linux.

from the Linux info pages for ulimit:

Here is a list of resources for which you can specify a
limit. Memory and file sizes are measured in bytes.

`RLIMIT_CPU'
The maximum amount of CPU time the process can use. If it
runs for longer than this, it gets a signal: `SIGXCPU'.
The value is measured in seconds. *Note Operation Error
Signals::.

`RLIMIT_FSIZE'
The maximum size of file the process can create. Trying to
write a larger file causes a signal: `SIGXFSZ'. *Note
Operation Error Signals::.

`RLIMIT_DATA'
The maximum size of data memory for the process. If the
process tries to allocate data memory beyond this amount,
the allocation function fails.

`RLIMIT_STACK'
The maximum stack size for the process. If the process
tries to extend its stack past this size, it gets a
`SIGSEGV' signal. *Note Program Error Signals::.

`RLIMIT_CORE'
The maximum size core file that this process can create.
If the process terminates and would dump a core file larger
than this, then no core file is created. So setting this
limit to zero prevents core files from ever being created.

`RLIMIT_RSS'
The maximum amount of physical memory that this process
should get. This parameter is a guide for the system's
scheduler and memory allocator; the system may give the
process more memory when there is a surplus.

`RLIMIT_MEMLOCK'
The maximum amount of memory that can be locked into
physical memory (so it will never be paged out).

`RLIMIT_NPROC'
The maximum number of processes that can be created with the
same user ID. If you have reached the limit for your user
ID, `fork' will fail with `EAGAIN'. *Note Creating a
Process::.

`RLIMIT_NOFILE'
`RLIMIT_OFILE'
The maximum number of files that the process can open. If
it tries to open more files than this, its open attempt
fails with `errno' `EMFILE'. *Note Error Codes::. Not all
systems support this limit; GNU does, and 4.4 BSD does.

`RLIMIT_AS'
The maximum size of total memory that this process should
get. If the process tries to allocate more memory beyond
this amount with, for example, `brk', `malloc', `mmap' or
`sbrk', the allocation function fails.

`RLIM_NLIMITS'
The number of different resource limits. Any valid RESOURCE
operand must be less than `RLIM_NLIMITS'.

-- Constant: int RLIM_INFINITY
This constant stands for a value of "infinity" when
supplied as the limit value in `setrlimit'.

`ulimit' and the command symbols are declared in `ulimit.h'.

HTH

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

The mind of the prudent is ever getting knowledge, and the
eear of the wise is ever seeking, inquiring for and craving
knowledge. Pr. 18:15 Amp

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Valentin Schmid - ICSurselva AG
2008-09-25 12:40:14 UTC
Permalink
Hi Keith,
Post by Keith Roberts
What OS are you running?
Linux (gentoo).
Post by Keith Roberts
If it's Unix/Linux then you might be able to
control these settings with ulimit.
Please see the manual page for ulimit for details.
man ulimit -> set or report file size limit
How would this help?
Post by Keith Roberts
info ulimit
I think this two resources are the relevant
Post by Keith Roberts
`RLIMIT_CPU'
The maximum amount of CPU time the process can use. If it runs for
longer than this, it gets a signal: `SIGXCPU'. The value is measured in
seconds. *Note Operation Error Signals::.
This will be used by apache (RLimitCPU) in srclib/apr/threadproc/unix/proc.c
Post by Keith Roberts
`RLIMIT_AS'
The maximum size of total memory that this process should get. If the
process tries to allocate more memory beyond this amount with, for
example, `brk', `malloc', `mmap' or `sbrk', the allocation function fails.
This will be used by apache (RLimitMEM) in srclib/apr/threadproc/unix/proc.c


As I understand you, the only possibility to solve my problem is to patch the
php source.
If I search in the php code after RLIMIT_ the only occurences are in ext/posix/posix.c
The RLIMIT_* are used there by posix_getrlimit (Rem: there's no posix_setrlimit).

Or is there another possibility?

Regards valli
Fabricio Vargas
2008-09-25 13:08:38 UTC
Permalink
Hi everyone

I have a Oracle database Release 11.1.0.6.0 x64 an Red Hat 5.2 x64
running perfectly and i need to install php with oracle connectivity in
the same machine. After follow diferentes guides (even mixed) always get
the same error "Call to undefined function ora_logon()"
In orden to get help from you I will explain the steps i made in the
configuration:

1) environments variables

In /etc/bashrc include this lines
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/11.1.0/db_1
export ORACLE_SID=lpz1
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin

2) Download and install the source of php in new session
#rpm -i php-5.1.6-20.el5.src.rpm
#cd /usr/src/redhat/SOURCES/
#tar -zxvf php-5.1.6.tar.gz
#cd php-5.1.6
#./configure --with-apxs2=/usr/sbin/apxs --prefix=$ORACLE_HOME
--enable-track-vars --with-oci8=shared,$ORACLE_HOME --with-gd
--enable-sigchild --with-zlib --disable-rpath
--with-config-file-path=/etc/httpd/conf --with-oracle=$ORACLE_HOME
#make
#make install (show output)

Installing PHP SAPI module: apache2handler
/usr/lib64/httpd/build/instdso.sh
SH_LIBTOOL='/usr/lib64/apr-1/build/libtool'
libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp
libphp5.la /usr/lib64/httpd/modules/
cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool
--finish /usr/src/redhat/SOURCES/php-5.1.6/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /opt/oracle/11.1.0/db_1/bin/
Installing PHP CLI man page: /opt/oracle/11.1.0/db_1/man/man1/
Installing shared
extensions: /opt/oracle/11.1.0/db_1/lib/php/extensions/no-debug-non-zts-20050922/
Installing build environment: /opt/oracle/11.1.0/db_1/lib/php/build/
Installing header files: /opt/oracle/11.1.0/db_1/include/php/
Installing helper programs: /opt/oracle/11.1.0/db_1/bin/
program: phpize
program: php-config
Installing man pages: /opt/oracle/11.1.0/db_1/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/oracle/11.1.0/db_1/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.4.9
Wrote PEAR system config file at: /opt/oracle/11.1.0/db_1/etc/pear.conf
You may want to add: /opt/oracle/11.1.0/db_1/lib/php to your php.ini
include_path
Installing PDO
headers: /opt/oracle/11.1.0/db_1/include/php/ext/pdo/

3)Final touches
#cp php.ini-dist /etc/php.ini
follow the output instructions in php.ini
include_path = ".:/opt/oracle/11.1.0/db_1/lib/php
#libtool --finish /usr/src/redhat/SOURCES/php-5.1.6/libs

4) in /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .phtml

5) Finally
#service httpd restart
go to the php page end i get
Fatal error: Call to undefined function ora_logon()
in /path/to/file/index.php on line 11

I hope you can help me

Cheers
Fabricio
Christopher Jones
2008-09-25 15:27:29 UTC
Permalink
PHP 5.1.6 doesn't have the old 'oracle' extension. It only has the
newer 'oci8' extension. Recent versions of PHP will give a warning
when an unknown 'configure' option is used, but 5.1 doesn't, IIRC.

If you are writing new PHP code, use oci8 functions (and remove the
--with-oracle option from 'configure'). If you have a small existing
code base, consider migrating it to oci8. If you have a large
existing code base, you will need to get 'oracle' from an older PHP
and build it. I can discuss this more if necessary.

I'd recommend upgrading oci8 to use the latest version from PECL;
again I can explain how, if you go this route.

For a mapping between the old "ora_xxx" and new "oci_xxx" functions,
see chapter 17 of the current version (1.4) of the Underground PHP &
Oracle Manual:
http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf

See
Post by Fabricio Vargas
Hi everyone
I have a Oracle database Release 11.1.0.6.0 x64 an Red Hat 5.2 x64
running perfectly and i need to install php with oracle connectivity in
the same machine. After follow diferentes guides (even mixed) always get
the same error "Call to undefined function ora_logon()"
In orden to get help from you I will explain the steps i made in the
1) environments variables
In /etc/bashrc include this lines
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/11.1.0/db_1
export ORACLE_SID=lpz1
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
2) Download and install the source of php in new session
#rpm -i php-5.1.6-20.el5.src.rpm
#cd /usr/src/redhat/SOURCES/
#tar -zxvf php-5.1.6.tar.gz
#cd php-5.1.6
#./configure --with-apxs2=/usr/sbin/apxs --prefix=$ORACLE_HOME
--enable-track-vars --with-oci8=shared,$ORACLE_HOME --with-gd
--enable-sigchild --with-zlib --disable-rpath
--with-config-file-path=/etc/httpd/conf --with-oracle=$ORACLE_HOME
#make
#make install (show output)
Installing PHP SAPI module: apache2handler
/usr/lib64/httpd/build/instdso.sh
SH_LIBTOOL='/usr/lib64/apr-1/build/libtool'
libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp
libphp5.la /usr/lib64/httpd/modules/
cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool
--finish /usr/src/redhat/SOURCES/php-5.1.6/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /opt/oracle/11.1.0/db_1/bin/
Installing PHP CLI man page: /opt/oracle/11.1.0/db_1/man/man1/
Installing shared
extensions: /opt/oracle/11.1.0/db_1/lib/php/extensions/no-debug-non-zts-20050922/
Installing build environment: /opt/oracle/11.1.0/db_1/lib/php/build/
Installing header files: /opt/oracle/11.1.0/db_1/include/php/
Installing helper programs: /opt/oracle/11.1.0/db_1/bin/
program: phpize
program: php-config
Installing man pages: /opt/oracle/11.1.0/db_1/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/oracle/11.1.0/db_1/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.4.9
Wrote PEAR system config file at: /opt/oracle/11.1.0/db_1/etc/pear.conf
You may want to add: /opt/oracle/11.1.0/db_1/lib/php to your php.ini
include_path
Installing PDO
headers: /opt/oracle/11.1.0/db_1/include/php/ext/pdo/
3)Final touches
#cp php.ini-dist /etc/php.ini
follow the output instructions in php.ini
include_path = ".:/opt/oracle/11.1.0/db_1/lib/php
#libtool --finish /usr/src/redhat/SOURCES/php-5.1.6/libs
4) in /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .phtml
5) Finally
#service httpd restart
go to the php page end i get
Fatal error: Call to undefined function ora_logon()
in /path/to/file/index.php on line 11
I hope you can help me
Cheers
Fabricio
--
Email: ***@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd Free PHP Book: http://tinyurl.com/f8jad
Fabricio Vargas
2008-09-25 17:47:12 UTC
Permalink
Christopher

I have a large existing code base, i will migrate to new oci8 in a few
weeks but now ,i need to solve this problem. Which version of php did
you recommend me to compile with oracle 11g?

Fabricio



-----Mensaje original-----
De: Christopher Jones <***@oracle.com>
Para: ***@asoban.bo
Cc: php-***@lists.php.net
Asunto: Re: [PHP-INSTALL] Install php5 oracle 11g x64 ora_logon() ISSUE
Fecha: Thu, 25 Sep 2008 08:27:29 -0700

PHP 5.1.6 doesn't have the old 'oracle' extension. It only has the
newer 'oci8' extension. Recent versions of PHP will give a warning
when an unknown 'configure' option is used, but 5.1 doesn't, IIRC.

If you are writing new PHP code, use oci8 functions (and remove the
--with-oracle option from 'configure'). If you have a small existing
code base, consider migrating it to oci8. If you have a large
existing code base, you will need to get 'oracle' from an older PHP
and build it. I can discuss this more if necessary.

I'd recommend upgrading oci8 to use the latest version from PECL;
again I can explain how, if you go this route.

For a mapping between the old "ora_xxx" and new "oci_xxx" functions,
see chapter 17 of the current version (1.4) of the Underground PHP &
Oracle Manual:
http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf

See
Post by Fabricio Vargas
Hi everyone
I have a Oracle database Release 11.1.0.6.0 x64 an Red Hat 5.2 x64
running perfectly and i need to install php with oracle connectivity in
the same machine. After follow diferentes guides (even mixed) always get
the same error "Call to undefined function ora_logon()"
In orden to get help from you I will explain the steps i made in the
1) environments variables
In /etc/bashrc include this lines
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/11.1.0/db_1
export ORACLE_SID=lpz1
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
2) Download and install the source of php in new session
#rpm -i php-5.1.6-20.el5.src.rpm
#cd /usr/src/redhat/SOURCES/
#tar -zxvf php-5.1.6.tar.gz
#cd php-5.1.6
#./configure --with-apxs2=/usr/sbin/apxs --prefix=$ORACLE_HOME
--enable-track-vars --with-oci8=shared,$ORACLE_HOME --with-gd
--enable-sigchild --with-zlib --disable-rpath
--with-config-file-path=/etc/httpd/conf --with-oracle=$ORACLE_HOME
#make
#make install (show output)
Installing PHP SAPI module: apache2handler
/usr/lib64/httpd/build/instdso.sh
SH_LIBTOOL='/usr/lib64/apr-1/build/libtool'
libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp
libphp5.la /usr/lib64/httpd/modules/
cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool
--finish /usr/src/redhat/SOURCES/php-5.1.6/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /opt/oracle/11.1.0/db_1/bin/
Installing PHP CLI man page: /opt/oracle/11.1.0/db_1/man/man1/
Installing shared
extensions: /opt/oracle/11.1.0/db_1/lib/php/extensions/no-debug-non-zts-20050922/
Installing build environment: /opt/oracle/11.1.0/db_1/lib/php/build/
Installing header files: /opt/oracle/11.1.0/db_1/include/php/
Installing helper programs: /opt/oracle/11.1.0/db_1/bin/
program: phpize
program: php-config
Installing man pages: /opt/oracle/11.1.0/db_1/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/oracle/11.1.0/db_1/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.4.9
Wrote PEAR system config file at: /opt/oracle/11.1.0/db_1/etc/pear.conf
You may want to add: /opt/oracle/11.1.0/db_1/lib/php to your php.ini
include_path
Installing PDO
headers: /opt/oracle/11.1.0/db_1/include/php/ext/pdo/
3)Final touches
#cp php.ini-dist /etc/php.ini
follow the output instructions in php.ini
include_path = ".:/opt/oracle/11.1.0/db_1/lib/php
#libtool --finish /usr/src/redhat/SOURCES/php-5.1.6/libs
4) in /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .phtml
5) Finally
#service httpd restart
go to the php page end i get
Fatal error: Call to undefined function ora_logon()
in /path/to/file/index.php on line 11
I hope you can help me
Cheers
Fabricio
Nuno Luz
2008-09-25 22:22:50 UTC
Permalink
Can anyone tell me how can I unsubscribe the list? I receive lots of e-mail
from PHP-INSTALL that I don't want to receive...

Thanks


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3469 (20080924) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Keith Roberts
2008-09-26 20:37:31 UTC
Permalink
Please see this archived post :)

http://marc.info/?l=php-install&m=114138567814319&w=2

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

The mind of the prudent is ever getting knowledge, and the
eear of the wise is ever seeking, inquiring for and craving
knowledge. Pr. 18:15 Amp

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Subject: [PHP-INSTALL] Unsubscribe please...
Can anyone tell me how can I unsubscribe the list? I receive lots of e-mail
from PHP-INSTALL that I don't want to receive...
Thanks
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3469 (20080924) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Christopher Jones
2008-09-29 17:50:08 UTC
Permalink
Fabricio,

I haven't tried to compile the old 'oracle' extension for a long time.
I doubt it will build with 11g without some config.m4 or Makefile tweaks.

Use the most recent version of PHP possible.

The basic steps are something similar to the "Installing OCI8 with PHP 4"
on p.81 of the Underground PHP & Oracle Manual, version 1.4:

- Extract a new PHP bundle
- Move the ext/oracle directory from an old PHP to your new PHP ext directory
- Make any changes necessary to identify 11g to the ext/oracle/config.m4
- Use 'buildconf --force' to rebuild the 'configure' script
- Run configure and make

Chris
Post by Fabricio Vargas
Christopher
I have a large existing code base, i will migrate to new oci8 in a few
weeks but now ,i need to solve this problem. Which version of php did
you recommend me to compile with oracle 11g?
Fabricio
-----Mensaje original-----
Asunto: Re: [PHP-INSTALL] Install php5 oracle 11g x64 ora_logon() ISSUE
Fecha: Thu, 25 Sep 2008 08:27:29 -0700
PHP 5.1.6 doesn't have the old 'oracle' extension. It only has the
newer 'oci8' extension. Recent versions of PHP will give a warning
when an unknown 'configure' option is used, but 5.1 doesn't, IIRC.
If you are writing new PHP code, use oci8 functions (and remove the
--with-oracle option from 'configure'). If you have a small existing
code base, consider migrating it to oci8. If you have a large
existing code base, you will need to get 'oracle' from an older PHP
and build it. I can discuss this more if necessary.
I'd recommend upgrading oci8 to use the latest version from PECL;
again I can explain how, if you go this route.
For a mapping between the old "ora_xxx" and new "oci_xxx" functions,
see chapter 17 of the current version (1.4) of the Underground PHP &
http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf
See
Post by Fabricio Vargas
Hi everyone
I have a Oracle database Release 11.1.0.6.0 x64 an Red Hat 5.2 x64
running perfectly and i need to install php with oracle connectivity in
the same machine. After follow diferentes guides (even mixed) always get
the same error "Call to undefined function ora_logon()"
In orden to get help from you I will explain the steps i made in the
1) environments variables
In /etc/bashrc include this lines
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/11.1.0/db_1
export ORACLE_SID=lpz1
export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
2) Download and install the source of php in new session
#rpm -i php-5.1.6-20.el5.src.rpm
#cd /usr/src/redhat/SOURCES/
#tar -zxvf php-5.1.6.tar.gz
#cd php-5.1.6
#./configure --with-apxs2=/usr/sbin/apxs --prefix=$ORACLE_HOME
--enable-track-vars --with-oci8=shared,$ORACLE_HOME --with-gd
--enable-sigchild --with-zlib --disable-rpath
--with-config-file-path=/etc/httpd/conf --with-oracle=$ORACLE_HOME
#make
#make install (show output)
Installing PHP SAPI module: apache2handler
/usr/lib64/httpd/build/instdso.sh
SH_LIBTOOL='/usr/lib64/apr-1/build/libtool'
libphp5.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp
libphp5.la /usr/lib64/httpd/modules/
cp .libs/libphp5.so /usr/lib64/httpd/modules/libphp5.so
cp .libs/libphp5.lai /usr/lib64/httpd/modules/libphp5.la
libtool: install: warning: remember to run `libtool
--finish /usr/src/redhat/SOURCES/php-5.1.6/libs'
chmod 755 /usr/lib64/httpd/modules/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /opt/oracle/11.1.0/db_1/bin/
Installing PHP CLI man page: /opt/oracle/11.1.0/db_1/man/man1/
Installing shared
extensions: /opt/oracle/11.1.0/db_1/lib/php/extensions/no-debug-non-zts-20050922/
Installing build environment: /opt/oracle/11.1.0/db_1/lib/php/build/
Installing header files: /opt/oracle/11.1.0/db_1/include/php/
Installing helper programs: /opt/oracle/11.1.0/db_1/bin/
program: phpize
program: php-config
Installing man pages: /opt/oracle/11.1.0/db_1/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/oracle/11.1.0/db_1/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR - already installed: 1.4.9
Wrote PEAR system config file at: /opt/oracle/11.1.0/db_1/etc/pear.conf
You may want to add: /opt/oracle/11.1.0/db_1/lib/php to your php.ini
include_path
Installing PDO
headers: /opt/oracle/11.1.0/db_1/include/php/ext/pdo/
3)Final touches
#cp php.ini-dist /etc/php.ini
follow the output instructions in php.ini
include_path = ".:/opt/oracle/11.1.0/db_1/lib/php
#libtool --finish /usr/src/redhat/SOURCES/php-5.1.6/libs
4) in /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php .phtml
5) Finally
#service httpd restart
go to the php page end i get
Fatal error: Call to undefined function ora_logon()
in /path/to/file/index.php on line 11
I hope you can help me
Cheers
Fabricio
--
Email: ***@oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd Free PHP Book: http://tinyurl.com/f8jad
Valentin Schmid - ICSurselva AG
2008-09-25 14:11:01 UTC
Permalink
Hi Keith again
What OS are you running? If it's Unix/Linux then you might be able to
control these settings with ulimit.
Please see the manual page for ulimit for details.
I see ...
Memory Limit of 8MB:
ulimit -v 8192
Time Limit of 30 seconds:
ulimit -t 30

But where can I execute this ulimit-commands per Virtualhost,
somewhere in the apache config or in the php config?

Kind Regards valli
Keith Roberts
2008-09-25 15:24:59 UTC
Permalink
Subject: Re: [PHP-INSTALL] Questions regarding limits of processes launchedby
system, exec, passthru ...
Hi Keith again
What OS are you running? If it's Unix/Linux then you might be able to
control these settings with ulimit.
Please see the manual page for ulimit for details.
I see ...
ulimit -v 8192
ulimit -t 30
But where can I execute this ulimit-commands per Virtualhost,
somewhere in the apache config or in the php config?
Kind Regards valli
Hi Valli. I'm using Fedora 8 Linux. I was going to suggest
that you try and set the resource limits for the user the
Apache PHP module runs as. This is probably the same
user:group as the Apache web server.

So you will need to set this in the OS shell, probably as
root user.

Then when the apache PHP module makes an OS system call,
hopefully the limits you have set for the Apache user:group
will apply.

HTH

Kind Regards,

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

The mind of the prudent is ever getting knowledge, and the
eear of the wise is ever seeking, inquiring for and craving
knowledge. Pr. 18:15 Amp

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Valentin Schmid - ICSurselva AG
2008-09-29 07:56:08 UTC
Permalink
Hello all again,

It seems that Problem can only be solved by one of the following ways:

1. Don't use mod_php; use CGI or FastCGI instead. Then it would be
possible to limit the resources via RLimitCPU / RLimitMEM.

2. Use one of the following apache core patch
http://archives.neohapsis.com/archives/openbsd/2005-12/1436.html
or the following apache module:
http://www.ucc.asn.au/~dagobah/things/mod_rlimit.c
(Unfortunately only for apache 1.3)

Thanks for all your answers.

Kind regards
valli
Post by Valentin Schmid - ICSurselva AG
Hello all,
Is there a way to limit the memory consumption and / or the CPU
consumption of processes launched by the php functions system,
exec, passthru, proc_open and shell_exec?
We use mod_php with an apache (mpm-prefork) on Linux.
max_execution_time 30
memory_limit 8M
RLimitCPU 30 30
RLimitMEM 8388608 8388608
The limits above do have effect on php-scripts (without system calls)
and on CGIs (as well on processes launched by CGIs).
Any Ideas?
Kind Regards
valli
system_memorytest.php
=====================
<html>
<head>
<title>php-systemcall-memory test</title>
</head>
<body>
php-systemcall-memory test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$s = "teststr_";
while (1) {
print "len=".length($s)."<br>\n";
sleep(1);
$s .= $s;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>
system_timeouttest.php
======================
<html>
<head>
<title>php-systemcall-timeout test</title>
</head>
<body>
php-systemcall-timeout test<br>
... and here's the system call:<br>
<pre>
<?php
$cmd = '/usr/bin/perl -e \'
$| = 1;
print "start of the systemcall<br>\n";
$i = 0;
while (1) {
if (($i % 10000000) == 0) {
print "i=".$i."<br>\n";
}
$i += 1;
}
\'';
print htmlspecialchars($cmd);
?>
</pre>
<?php
ob_flush();
flush();
system($cmd);
?>
</body>
</html>
Loading...