A good article, I used to set up FCGI the same way. I had to find all the necessary info myself, when I first tried to use FCGI with a multi-site setup (separate PHP config, etc. for each site), but I'm glad that meanwhile somebody took the time to write it down.
Comments
FastCGI (aka. mod_fcgid) and the PHP_FCGI_CHILDREN variable
PHP_FCGI_CHILDREN
to anything else than0
if you use it with mod_fcgi. This is pretty well described in the mod_fcgi documentation.Nonetheless I had this set to
5
for a long time and it did not cause any problems. Recently the server was upgraded from Debian Lenny to Squeeze and the server died even under minimum load. Even a couple (a dozen) PHP requests caused the PHP processes (php5-cgi
) to push the CPU to 100% (actually it pushed the wait percentage up as if there was heavy disk I/O ... and soon the system started swapping too as if memory was depleted). I couldn't find the culprit for quite some time, but then came to a post aboutPHP_FCGI_CHILDREN
and how one should set it to zero in case one uses it with FCGI. So I did it and it fixed the problem. The server started acting normal again.It seems that the mod_fcgid in Lenny (2.2-1+lenny1) and in Squeeze (2.3.6-1) handle
PHP_FCGI_CHILDREN
a bit differently. At least I did not find anything else to be different (the PHP version was the same before and after the upgrade, because I had to keep the old PHP5 from Lenny since a lot of our PHP sites do not work well with PHP 5.3 and Squeeze has 5.3, Lenny had 5.2).So today's learning was: always set
PHP_FCGI_CHILDREN
to0
in your PHP wrapper script if you use FastCGI (mod_fcgid).(P.S.: the article linked to this post tells you otherwise ... don't listen to it's bad advice