Re: [PHP] Re: Questions regarding limits of processes launched by system, exec,passthru ...

2008-09-30 Thread Thodoris



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.



I haven't tried that but as I have noticed in the reference that 
probably mod_php's processes get limited too:


This applies to processes forked off from Apache children servicing 
requests, not the Apache children themselves.
This includes CGI scripts and SSI exec commands, but not any processes 
forked off from the Apache parent such as piped logs.


It says that it includes CGI but it doesn't exclude necessarily mod_php. 
Does it ?



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



Let us know if you try this.

--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Questions regarding limits of processes launched by system, exec,passthru ...

2008-09-29 Thread Valentin Schmid - ICSurselva AG

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

Valentin Schmid - ICSurselva AG wrote:

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
=


  php-systemcall-memory test


  php-systemcall-memory test
  ... and here's the system call:
  
\n";
  $s = "teststr_";
  while (1) {
 print "len=".length($s)."\n";
 sleep(1);
 $s .= $s;
  }
   \'';
   print htmlspecialchars($cmd);
?>
  





system_timeouttest.php
==


  php-systemcall-timeout test


  php-systemcall-timeout test
  ... and here's the system call:
  
\n";
  $i = 0;
  while (1) {
 if (($i % 1000) == 0) {
print "i=".$i."\n";
 }
 $i += 1;
  }
   \'';
   print htmlspecialchars($cmd);
?>
  








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php