中国青基会
RSS
热门关键字:  None  linux+moodle安装  mac  rhel5  199
当前位置 : Nixsky>服务器>Web>列表

CentOS下Zeus 4.3r3的安装及基本配置

来源: 作者: 时间:2007-03-09 点击:
# Location to place semaphore
SEMFILE=/tmp/php.pid
PHP_FCGI_CHILDREN=100
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS

# This is Linux - use /proc to increase the local (ephemeral) port range
#echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

if [ -z "$ZEUSHOME" ]
then
cd `dirname $0`/..
ZEUSHOME=`pwd`
export ZEUSHOME
fi

case "$1" in
'start')

if [ -e $SEMFILE ]
then
echo FastCGI PHP error: already running.Restart FastCGI PHP now
kill `cat $SEMFILE`
sleep 5
fi

if [ ! -x $FPHPBIN ]
then
echo FastCGI PHP error: please check that $FPHPBIN is executable and exists.
exit 1
fi

echo Starting FastCGI PHP.
$ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN
;;

'stop')
if [ -e $SEMFILE ]
then
echo Stopping FastCGI PHP.
kill `cat $SEMFILE`
rm $SEMFILE
exit 0
fi
;;
'restart')
if [ -e $SEMFILE ]
then
echo Stopping FastCGI PHP.
kill `cat $SEMFILE`
sleep 5
fi
echo Starting FastCGI PHP.
$ZEUSHOME/web/bin/fcgirunner --user=65534 --group=65534 --pidfile=$SEMFILE 8002 $FPHPBIN
;;
*)
echo "usage: $0 {start|stop|restart}"
;;

esac
exit 1

在这个脚本中有以下内容需要视系统情况而修改:

FPHPBIN=/usr/local/php/bin/php 应设置为php的路径

SEMFILE=/tmp/php.pid 生成php.pid的路径,该目录必须可写

PHP_FCGI_CHILDREN=100 php进程数目

PHP_FCGI_MAX_REQUESTS=1000 每个php的进程在退出前能够响应的请求数,用于释放资源,
上面两个根据硬件配置和网站访问量设置,默认值是8,500。一般来说 PHP_FCGI_CHILDREN > 访问并发最大值+10
PHP_FCGI_MAX_REQUESTS 如果设置过小,访问量大的网站会因为php进程重起频繁增加负荷。

#echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range 只用于linux

--user=65534 --group=65534 为php进程运行的用户和组,一般设置为nobody用户和组
FreeBSD是65534/65534,Linux是99/99

保存!
chmod 750 S05php
cd ..
./restart-zeus

一但启动后就会在ps -ax列表中显示出PHP_FCGI_CHILDREN+1个php进程。
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册