- 论坛徽章:
- 0
|
自己正在用的,可能是我拿freebsd port官方脚本改的,在Freebsd7.0和lighttpd上大负载稳定运行半年了,就是启动有点慢
#!/bin/sh
# FreeBSD rc.d script for fastcgi+php
# in rc.conf
# fcgiphp_enable (bool): Set it to "YES" to enable fastcgi+php
# Default is "NO".
# other options see below
#
. /etc/rc.subr
name="fcgiphp"
rcvar=`set_rcvar`
load_rc_config $name
: ${fcgiphp_enable="NO"}
: ${fcgiphp_bin_path="/usr/local/bin/php-cgi"}
: ${fcgiphp_user="www"}
: ${fcgiphp_group="www"}
: ${fcgiphp_children="50"}
: ${fcgiphp_port="9000"}
: ${fcgiphp_socket=""}
: ${fcgiphp_env="SHELL PATH USER"}
: ${fcgiphp_max_requests="1000"}
: ${fcgiphp_addr="127.0.0.1"}
pidfile=/var/run/fcgiphp/fcgiphp.pid
procname="${fcgiphp_bin_path}"
command_args="/usr/local/bin/spawn-fcgi -f ${fcgiphp_bin_path} -a ${fcgiphp_addr} -p ${fcgiphp_port} -u ${fcgiphp_user} -g ${fcgiphp_group} -C ${fcgiphp_children} -P ${pidfile}"
start_precmd=start_precmd
stop_postcmd=stop_postcmd
start_precmd()
{
PHP_FCGI_MAX_REQUESTS="${fcgiphp_max_requests}"
export PHP_FCGI_MAX_REQUESTS
allowed_env="${fcgiphp_env} PHP_FCGI_MAX_REQUESTS"
# copy the allowed environment variables
E=""
for i in $allowed_env; do
eval "x=\$$i"
E="$E $i=$x"
done
command="env - $E"
}
stop_postcmd()
{
rm -f ${pidfile}
# eval "ipcs | awk '{ if (\$5 == \"${fcgiphp_user}\") print \"ipcrm -s \"\$2}' | /bin/sh"
}
run_rc_command "$1"
|
|
|