PHP FastCGI启动脚本(for RHEL)

#!/bin/sh
#
# php-cgi Startup script for the php-cgi server
#
# chkconfig: - 85 15
# description: fast cgi server for php
#
# processname: php-cgi
# config: /etc/php.ini
# pidfile: /var/run/php-cgi.pid
#
# Note: pidfile is assumed to be created
# by php-cgi (config: server.pid-file).
# If not, uncomment 'pidof' line.

# Source function library
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/php-cgi ]; then
        . /etc/sysconfig/php-cgi
fi

prog="php-cgi"
FCGIPHP=/usr/bin/php-cgi
FCGIPORT="8080"
FCGIADDR="127.0.0.1"
FCGIUSER="apache"
PHP_FCGI_CHILDREN=5
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS

RETVAL=0

start() {
        echo -n $"Starting $prog: "
        daemon --user $FCGIUSER "export PHP_FCGI_CHILDREN=5; export PHP_FCGI_MAX_REQUESTS=1000; $FCGIPHP -b $FCGIADDR:$FCGIPORT &"
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc $FCGIPHP
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
        return $RETVAL
}

reload() {
        echo -n $"Reloading $prog: "
        killproc $FCGIPHP -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/lock/subsys/$prog ]; then
                        stop
                        start
                fi
                ;;
        reload)
                reload
                ;;
        status)
                status $FCGIPHP
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
                RETVAL=1
esac

exit $RETVAL

你可能感兴趣的:(apache,PHP,脚本,F#,cgi)