1、在目录/etc/init.d添加文件:php-cgi,内容
#!/bin/bash
PHP_SCRIPT=/usr/bin/spawn-fcgi
PHPCS="-a 127.0.0.1 -p 9000 -u www-data -C 10 -f /usr/bin/php-cgi"
RETVAL=0
case "$1" in
start)
echo "Starting fastcgi"
$PHP_SCRIPT $PHPCS
RETVAL=$?
;;
stop)
echo "Stopping fastcgi"
killall -9 php-cgi
RETVAL=$?
;;
restart)
echo "Restarting fastcgi"
killall -9 php-cgi
$PHP_SCRIPT RETVAL=$?
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}" exit 1 ;; esac exit $RETVAL
2、安装 sysv-rc-conf
运行 sysv-rc-conf php-cgi on
#!/bin/bash
PHP_SCRIPT=/usr/bin/spawn-fcgi
PHPCS="-a 127.0.0.1 -p 9000 -u www-data -C 10 -f /usr/bin/php-cgi"
RETVAL=0
case "$1" in
start)
echo "Starting fastcgi"
$PHP_SCRIPT $PHPCS
RETVAL=$?
;;
stop)
echo "Stopping fastcgi"
killall -9 php-cgi
RETVAL=$?
;;
restart)
echo "Restarting fastcgi"
killall -9 php-cgi
$PHP_SCRIPT RETVAL=$?
;;
*)
echo "Usage: php-fastcgi {start|stop|restart}" exit 1 ;; esac exit $RETVAL
2、安装 sysv-rc-conf
运行 sysv-rc-conf php-cgi on