这个是在debian下可用的spawn-fcgi启动脚本,如果debian版本无法用apt-get安装spawn的话

[codesyntax lang="bash"]

#!/bin/bash
###################################
#
# Startup script for Spawn-fcgi
# chkconfig: - 85 15
# description: Start script for the php-fcgi
# processname: php-fcgi

BIND_HOST=127.0.0.1
BIND_PORT=9000
USER=www-data
PHP_FCGI_CHILDREN=150
PHP_FCGI_MAX_REQUESTS=30000

PHP_DAEMON=/usr/bin/spawn-fcgi
PHP_DAEMON_PIDFILE=/var/run/spawn-fcgi.pid
PHP_CGI=/usr/bin/php5-cgi
PHP_CGI_NAME=`basename $PHP_DAEMON`
PHP_CGI_ARGS="-a $BIND_HOST -p $BIND_PORT -u $USER -f $PHP_CGI -C $PHP_FCGI_CHILDREN -P $PHP_DAEMON_PIDFILE"

export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS
RETVAL=0

PATH=/sbin:/usr/sbin:usr/local/sbin:$PATH

start() {
      echo -n "Starting PHP FastCGI: "
	  start-stop-daemon --start --quiet --background --pidfile $PHP_DAEMON_PIDFILE --exec $PHP_DAEMON -- $PHP_CGI_ARGS
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}
stop() {
      echo -n "Stopping PHP FastCGI: "
	  #killall -q -w -u $USER $PHP_CGI
      for i in `pgrep php5-cgi`;do kill $i;done
      RETVAL=$?
      echo "$PHP_CGI_NAME."
}

case "$1" in
    start)
      start
  ;;
    stop)
      stop
  ;;
    restart)
      stop
        sleep 2
      start
  ;;
    *)
      echo "Usage: spawn-fcgi {start|stop|restart}"
      exit 1
  ;;
esac
exit $RETVAL

[/codesyntax]