Ressource Limit Patch for suPHP 0.5.2 (obsolete)

Note: this patch is obsolete. There is a more current versions of suPHP 0.6.x where rlimits can be set via the Apache configuration using the directives RLimitCPU, RLimitMEM, RLimitNPROC.

rlimit-patch for suPHP

  1. download suphp from suPHP download and extract it
  2. download the patch
  3. apply the patch using patch -p0 < rlimit-0.1.0-0.5.2-patch
  4. change into suPHP's directory
  5. run autoconf
  6. run autoheader

after this the configuration possibilities are enhanced by the following options

  --with-rlimit-cpu=SECONDS
                          limit cpu time with setrlimit
  --with-rlimit-as=BYTES  limit total available memory with setrlimit
  --with-rlimit-nproc=COUNT
                          limit number of processes with setrlimit
  --with-rlimit-nofile=COUNT
                          limit number of open files with setrlimit

so just run configure with your preferences, make, and make install

e.g. ./configure --prefix=/usr/local --with-apache-user=apache --with-rlimit-cpu=120 --with-rlimit-as=52428800 --with-rlimit-nproc=15 --with-rlimit-nofile=100
make && make install
this will limit every execution of a php script to 2 minutes cpu time, 50 MB memory, 15 processes, and a maximum number of 100 open files.
For the other configuration directives see the suPHP documentation

The patch is tested with Apache 1.3.x only!

Valid XHTML 1.0!