PHP init script to go with nginx?

mike mike503 at gmail.com
Fri Jun 13 19:42:16 MSD 2008


I've had problems with spawn-fcgi. It completely ignores
PHP_FCGI_MAX_REQUESTS and never actually terminates the children... I
noticed this on every box I had.

Why are people still using the wrong tools for the job anyway? PHP-FPM
does it properly, and the latest development version even allows for
strict process control (a proper max_execution_time that uses normal
seconds, not CPU seconds) and will soon allow for apache style child
process spawning - so it will adapt to your load.

spawn-fcgi is useless. If you can't use PHP-FPM, all you really need
to do is run

set the two environment variables, and then:
sudo -u $user /usr/local/bin/php-cgi -b $port

I put this in an upstart file and it worked great. It also recycled
engines properly and when I killed the parent the children died. I
assume this could be done the same way with daemontools since it runs
like an init process (upstart, inittab or daemontools should all
support this) - I had issues also with spawn-fcgi not killing the
children when I killed the parent, which is kind of against the point
to begin with :) PHP has built-in fastcgi management, its just not
robust... so people use tools like spawn-fcgi which are not required.
PHP-FPM makes that more robust and works so amazingly well - I run it
on all my boxes now and will -never- go back to anything else. With
luck, Andrei will get it into PHP core too so it will become the
defacto standard for FastCGI management without any external patch
anyway.



On 6/13/08, Stefanita Rares Dumitrescu <katmai at keptprivate.com> wrote:
> you can just run php with lighttpd spawn-fcgi, and daemontools for
> monitoring it. i find it rock solid.





More information about the nginx mailing list