3 # Created 2010-09-26 by presbrey@mit.edu
5 # php This shell script takes care of starting and stopping PHP
8 # description: manages PHP spawned in FastCGI mode with spawn-fcgi
10 # config: /etc/php.ini
13 # Source function library
14 if [ -f /etc/rc.d/init.d/functions ]; then
15 . /etc/rc.d/init.d/functions
16 elif [ -f /etc/init.d/functions ]; then
17 . /etc/init.d/functions
18 elif [ -f /etc/rc.d/functions ]; then
22 pidfile=${PIDFILE-/var/run/php.pid}
23 lockfile=${LOCKFILE-/var/lock/subsys/php}
24 PHP_BIN=/usr/bin/php-cgi
25 PHP_SOCK=/tmp/php.sock
30 # Read configuration (environment etc.)
31 if [ -f /etc/sysconfig/php ]; then
37 # See how we were called.
41 echo -n "Starting php: "
42 daemon --pidfile=${pidfile} spawn-fcgi -C $PHP_CHILDREN -f $PHP_BIN -u $PHP_USER -g $PHP_GROUP -s $PHP_SOCK -P $pidfile
45 [ $RETVAL = 0 ] && touch ${lockfile}
49 echo -n "Stopping php: "
50 killproc -p ${pidfile} -d 1 $PID_BIN -9
53 [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
60 status -p $pidfile $PHP_BIN
64 echo "Usage: php {start|stop|restart|reload|status}"