Permalink
Browse files

Add php-cgi for CentOS.

  • Loading branch information...
1 parent 9a6c585 commit fb62ffa07548241675ef832e3181fd76bedd8231 @huacnlee committed Jul 30, 2012
Showing with 53 additions and 0 deletions.
  1. +53 −0 centos/php-cgi
View
@@ -0,0 +1,53 @@
+#!/bin/bash
+# chkconfig: - 64 36
+# description: PHP FastCGI daemon
+# processname: php-cgi
+#
+# To install php5-cgi
+# sudo apt-get install php5-cgi
+. /etc/rc.d/init.d/functions
+. /etc/sysconfig/network
+
+BIND=127.0.0.1:9000
+USER=www-data
+PHP_FCGI_CHILDREN=5
+PHP_FCGI_MAX_REQUESTS=1000
+
+PHP_CGI=/usr/local/bin/php-cgi
+PHP_CGI_NAME=`basename $PHP_CGI`
+PHP_CGI_ARGS="USER=$USER PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS nohup $PHP_CGI -b $BIND > /var/log/php-cgi.log &"
+RETVAL=0
+
+start() {
+ [ -x $PHP_CGI ] || exit 5
+ echo -n "Starting PHP FastCGI: "
+ daemon $PHP_CGI_ARGS
+ echo ""
+ RETVAL=$?
+ return $RETVAL
+}
+stop() {
+ echo -n "Stoping PHP FastCGI: "
+ killproc php-cgi -QUIT
+ echo ""
+ RETVAL=$?
+ return $RETVAL
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: php-cgi {start|stop|restart}"
+ exit 1
+ ;;
+esac
+exit $RETVAL

0 comments on commit fb62ffa

Please sign in to comment.