Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Lighttpd on 256MB RAM VPS (with low estimated traffic).

In order to optimize my server performances I decided to change these settings:

                    "PHP_FCGI_CHILDREN" => "1",
                    "PHP_FCGI_MAX_REQUESTS" => "20"

The reason why I set 1 child is that with setting there are 4 php_cgi processes:

2413 11336 /usr/bin/php-cgi 2415 4592 /usr/bin/php-cgi 2417 11336 /usr/bin/php-cgi 2419 27656 /usr/bin/php-cgi

If I set 4 I get >8 children. I'm wondering why and if this is ok. Now my webserver is very fast, because I finally don't rely on swapping so massively as before.


share|improve this question
up vote 2 down vote accepted

As you can see in this FAQ there are three config options that control the number of mod_php processes.

  • PHP_FCGI_CHILDREN (defaults to 1)
  • max-procs (defaults to 4)
  • min-procs (ignored in current releases)

The formula to caluclate the initially spawned processes looks like this:

no_of_procs = max-procs * ( PHP_FCGI_CHILDREN + 1) 

This means, for every procs in max-procs launch PHP_FCGI_CHILDREN workers +1 Guardian process for each parent in max-procs.

share|improve this answer

For newer lighttpd instances, you should set PHP_FCGI_CHILDREN to 0 and control the number of instances spawned.

This can help reduce the number of total processes running as there does not need to be extra master processes. However, if you are using a bytecode cache, set only 1 spawned master process and control the children below it.

Set PHP_MAX_REQUESTS to 500 to avoid another potential problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.