PHP, Apache, Mongrel cluster

Allen Parker parker at isohunt.com
Thu Jan 24 16:42:20 MSK 2008


Cliff Wells wrote:
> On Thu, 2008-01-17 at 16:48 +0100, Stefanita rares Dumitrescu wrote:
> 
>> one note though, when using php-fastcgi, i would suggest using
>> lighthttpd's spawn-fcgi program. i had issues with the init scripts
>> found for php-fascgi.
> 
> I concur.  The spawn-fcgi program from Lighttpd is how I run PHP as
> well.
> 
> Cliff
> 
> 

If you combine spawn-fcgi (from lighttpd) with daemontools, you get an 
indestructible php-fcgi, simply killall -9 php-cgi (or your distro's 
equivalent) and php will automatically be restarted ;-)

The benefit here is that if php craps out, daemontools will notice and 
restart it.

sample 'run' file:
#!/bin/sh

CHILDREN="25"

FCGI_HOST=127.0.0.1
FCGI_USER=php
FCGI_GROUP=php
FCGI_BIN=/usr/bin/php-cgi
FCGI_PORT=1705

test -x $FCGI_BIN || { echo "$FCGI_BIN not installed";
         if [ "$1" = "stop" ]; then exit 0;
         else exit 5; fi; }




export SHELL="/bin/bash"
exec /usr/bin/spawn-fcgi -n \
                           -f $FCGI_BIN \
                           -a $FCGI_HOST \
                           -p $FCGI_PORT \
                           -u $FCGI_USER \
                           -g $FCGI_GROUP \
                           -C $CHILDREN





More information about the nginx mailing list