CentOS / Red Hat PHP FastCGI script For Ngnix / Lighttpd / Apache Webserver




+ Reply to Thread
Results 1 to 3 of 3

Thread: CentOS / Red Hat PHP FastCGI script For Ngnix / Lighttpd / Apache Webserver

  1. #1
    The Server Admin is offline Junior Member
    Join Date
    Jul 2010
    Posts
    8
    Feedback Score
    0

    CentOS / Red Hat PHP FastCGI script For Ngnix / Lighttpd / Apache Webserver

    CentOS / Red Hat PHP FastCGI script For Ngnix / Lighttpd / Apache Webserver

    A shell script to start / stop / restart php-cgi as an app server. By default it will bind to 127.0.0.1 IP and 9000 port using spawn-fcgi. This script is tested on CentOS / RHEL / Fedora Linux only.
    How do I use this script?

    Install spawn-fcgi package using yum command.
    Download this script and place in /etc/init.d/ directory as /etc/init.d/php_cgi
    Code:
    # wget http://www.adminspoint.com/attachment.php?attachmentid=8&d=1278245810  -O  /etc/init.d/php_cgi
    # chmod +x /etc/init.d/php_cgi
    php_cgi init.d sysv style script

    Code:
    #!/bin/sh
    #
    # php-cgi - php-fastcgi swaping via  spawn-fcgi
    #
    # chkconfig:   - 85 15
    # description:  Run php-cgi as app server
    # processname: php-cgi
    # config:      /etc/sysconfig/phpfastcgi (defaults RH style)
    # pidfile:     /var/run/php_cgi.pid
    # Source function library.
    . /etc/rc.d/init.d/functions
     
    # Source networking configuration.
    . /etc/sysconfig/network
     
    # Check that networking is up.
    [ "$NETWORKING" = "no" ] && exit 0
     
    spawnfcgi="/usr/bin/spawn-fcgi"
    php_cgi="/usr/bin/php-cgi"
    prog=$(basename $php_cgi)
    server_ip=127.0.0.1
    server_port=9000
    server_user=nginx
    server_group=nginx
    server_childs=5
    pidfile="/var/run/php_cgi.pid"
     
    # do not edit, put changes in /etc/sysconfig/phpfastcgi
    [ -f /etc/sysconfig/phpfastcgi ] && . /etc/sysconfig/phpfastcgi
     
    start() {
        [ -x $php_cgi ] || exit 1
        [ -x $spawnfcgi ] || exit 2
        echo -n $"Starting $prog: "
        daemon $spawnfcgi -a ${server_ip} -p ${server_port} -u ${server_user} -g ${server_group} -P ${pidfile} -C ${server_childs} -f ${php_cgi}
        retval=$?
        echo
        return $retval
    }
     
    stop() {
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile} $prog -QUIT
        retval=$?
        echo
        [ -f ${pidfile} ] && /bin/rm -f ${pidfile}
        return $retval
    }
     
    restart(){
        stop
        sleep 2
        start
    }
     
    rh_status(){
        status -p ${pidfile} $prog
    }
     
    case "$1" in
        start)
            start;;
        stop)
            stop;;
        restart)
            restart;;
        status)
            rh_status;;
        *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 3
    esac
    Attached Files Attached Files

  2. #2
    pendel is offline Junior Member
    Join Date
    Jun 2011
    Posts
    1
    Feedback Score
    0
    Awsome work. I will try it now

  3. #3
    dansskittles is offline Junior Member
    Join Date
    Mar 2011
    Posts
    1
    Feedback Score
    0
    Thanks! Looks great!

+ Reply to Thread

Visitors found this page by searching for:

centos php-cgi script

sysconfig spawn-fcgi

centos spawn-fcgi sysconfig

php fastcgi init script centos

spawn-fcgi script centos

centos fastcgi init

apache fastcgi centos

centos php_cgi script

init script for php-fastcgi amazon

.pl /usr/bin/spawn-cgi

fastcgi init script centos

centos restart spawn-fcgi

lighttpd spawn-cgi

php-cgi init script centos

script arranque apache red hat

centos Fastcgi init script

spawn-fcgi centos

centos spawn-fcgi

php-fastcgi centos

spawn-fcgi init.d shell script:

sysconfig/spawn-fcgi

centos lighttpd

fastcgi script centos

redhat lighttpd

spawn-fcgi redhat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts