Annotation of embedaddon/lighttpd/doc/scripts/spawn-php.sh, revision 1.1.1.1

1.1       misho       1: #!/bin/bash
                      2: 
                      3: ## ABSOLUTE path to the spawn-fcgi binary
                      4: SPAWNFCGI="/home/weigon/projects/spawn-fcgi/src/spawn-fcgi"
                      5: 
                      6: ## ABSOLUTE path to the PHP binary
                      7: FCGIPROGRAM="/usr/local/bin/php"
                      8: 
                      9: ## TCP port to which to bind on localhost
                     10: FCGIPORT="1026"
                     11: 
                     12: ## number of PHP children to spawn
                     13: PHP_FCGI_CHILDREN=10
                     14: 
                     15: ## maximum number of requests a single PHP process can serve before it is restarted
                     16: PHP_FCGI_MAX_REQUESTS=1000
                     17: 
                     18: ## IP addresses from which PHP should access server connections
                     19: FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.2.10"
                     20: 
                     21: # allowed environment variables, separated by spaces
                     22: ALLOWED_ENV="ORACLE_HOME PATH USER"
                     23: 
                     24: ## if this script is run as root, switch to the following user
                     25: USERID=wwwrun
                     26: GROUPID=wwwrun
                     27: 
                     28: 
                     29: ################## no config below this line
                     30: 
                     31: if test x$PHP_FCGI_CHILDREN = x; then
                     32:   PHP_FCGI_CHILDREN=5
                     33: fi
                     34: 
                     35: export PHP_FCGI_MAX_REQUESTS
                     36: export FCGI_WEB_SERVER_ADDRS
                     37: 
                     38: ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
                     39: 
                     40: if test x$UID = x0; then
                     41:   EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN"
                     42: else
                     43:   EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN"
                     44: fi
                     45: 
                     46: # copy the allowed environment variables
                     47: E=
                     48: 
                     49: for i in $ALLOWED_ENV; do
                     50:   E="$E $i=${!i}"
                     51: done
                     52: 
                     53: # clean the environment and set up a new one
                     54: env - $E $EX

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>