spawn-fcgi更新到1.6.0版本了,默认是不需要使用参数-C来设定开启php-cgi的数量了,沿用内置php-cgi的规则,使用env环境变量PHP_FCGI_CHILDREN来控制php-cgi的数量。我写了一个脚本,用于开启、关闭spawn-fcgi,大家可以直接使用。
#! /bin/bash # This program write by yorgo(yorgo at ruisoft.com) on 2009/04/02 # Last modified 2009/04/03 # version 1.1 # use this script to start or stop spawn-fcgi address="127.0.0.1" port="9000" pidpath="/tmp/spawn_phpcgi_${port}.pid" user="apache" group="apache" phpcgi="/usr/local/php-cgi/bin/php-cgi" PHP_FCGI_CHILDREN=16 PHP_FCGI_MAX_REQUESTS=1000 startspawn() { env - PHP_FCGI_CHILDREN=${PHP_FCGI_CHILDREN} PHP_FCGI_MAX_REQUESTS=${PHP_FCGI_MAX_REQUESTS} /usr/local/php-cgi/bin/spawn-fcgi -a ${address} -p ${port} -u ${user} -g ${group} -f ${phpcgi} -P ${pidpath} echo "success start." } if [ "$1" == "start" ] then if [ ! -f $pidpath ] then startspawn else pidcount=`ps -ef |grep ${phpcgi}|wc -l` if [ "$pidcount" -gt "1" ] then echo "service is already running." else rm -f ${pidpath} startspawn fi fi elif [ "$1" == "stop" ] then pid=`cat ${pidpath}` kill ${pid} rm -f ${pidpath} echo "success stop." else echo "spawnmanager.sh [start|stop]" exit fi











