开启多子进程PHP

 1 #!/bin/sh
 2 #
 3 # php-cgi - php-fastcgi swaping via  spawn-fcgi
 4 #
 5 # chkconfig:   - 85 15
 6 # description:  Run php-cgi as app server
 7 # processname: php-cgi
 8 # config:      /etc/sysconfig/phpfastcgi (defaults RH style)
 9 # pidfile:     /var/run/php_cgi.pid
10 # Note: See how to use this script :
11 # http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14 
15 # Source networking configuration.
16 . /etc/sysconfig/network
17 
18 # Check that networking is up.
19 [ "$NETWORKING" = "no" ] && exit 0
20 
21 spawnfcgi="/usr/local/bin/spawn-fcgi"
22 php_cgi="/usr/local/php/bin/php-cgi"
23 prog=$(basename $php_cgi)
24 server_ip=127.0.0.1
25 server_port=9000
26 server_user=www
27 server_group=www
28 server_childs=256
29 pidfile="/var/run/php_cgi.pid"
30  
31 # do not edit, put changes in /etc/sysconfig/phpfastcgi
32 [ -f /etc/sysconfig/phpfastcgi ] && . /etc/sysconfig/phpfastcgi
33  
34 start() {
35     [ -x $php_cgi ] || exit 1
36     [ -x $spawnfcgi ] || exit 2
37     echo -n $"Starting $prog: "
38     daemon $spawnfcgi -a ${server_ip} -p ${server_port} -u ${server_user} -g ${server_group} -P ${pidfile} -C ${server_childs} -f ${php_cgi}
39     retval=$?
40     echo
41     return $retval
42 }
43  
44 stop() {
45     echo -n $"Stopping $prog: "
46     killproc -p ${pidfile} $prog -QUIT
47     retval=$?
48     echo
49     [ -f ${pidfile} ] && /bin/rm -f ${pidfile}
50     return $retval
51 }
52  
53 restart(){
54         stop
55         sleep 2
56         start
57 }
58  
59 rh_status(){
60         status -p ${pidfile} $prog
61 }
62  
63 case "$1" in
64     start)
65         start;;
66     stop)
67         stop;;
68     restart)
69         restart;;
70     status)
71         rh_status;;
72     *)
73         echo $"Usage: $0 {start|stop|restart|status}"
74         exit 3
75 esac

转载于:https://www.cnblogs.com/zwkuang/archive/2012/11/02/2751786.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值