You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
Bash
55 lines
1.3 KiB
Bash
19 years ago
|
#!/bin/bash
|
||
|
|
||
|
## ABSOLUTE path to the spawn-fcgi binary
|
||
|
SPAWNFCGI="/home/weigon/projects/spawn-fcgi/src/spawn-fcgi"
|
||
|
|
||
|
## ABSOLUTE path to the PHP binary
|
||
|
FCGIPROGRAM="/usr/local/bin/php"
|
||
|
|
||
18 years ago
|
## TCP port to which to bind on localhost
|
||
19 years ago
|
FCGIPORT="1026"
|
||
|
|
||
18 years ago
|
## number of PHP children to spawn
|
||
19 years ago
|
PHP_FCGI_CHILDREN=10
|
||
|
|
||
18 years ago
|
## maximum number of requests a single PHP process can serve before it is restarted
|
||
19 years ago
|
PHP_FCGI_MAX_REQUESTS=1000
|
||
|
|
||
18 years ago
|
## IP addresses from which PHP should access server connections
|
||
19 years ago
|
FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.2.10"
|
||
|
|
||
18 years ago
|
# allowed environment variables, separated by spaces
|
||
19 years ago
|
ALLOWED_ENV="ORACLE_HOME PATH USER"
|
||
|
|
||
18 years ago
|
## if this script is run as root, switch to the following user
|
||
19 years ago
|
USERID=wwwrun
|
||
|
GROUPID=wwwrun
|
||
|
|
||
|
|
||
|
################## no config below this line
|
||
|
|
||
|
if test x$PHP_FCGI_CHILDREN = x; then
|
||
|
PHP_FCGI_CHILDREN=5
|
||
|
fi
|
||
|
|
||
|
export PHP_FCGI_MAX_REQUESTS
|
||
|
export FCGI_WEB_SERVER_ADDRS
|
||
|
|
||
|
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
|
||
|
|
||
|
if test x$UID = x0; then
|
||
|
EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN"
|
||
|
else
|
||
|
EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN"
|
||
|
fi
|
||
|
|
||
|
# copy the allowed environment variables
|
||
|
E=
|
||
|
|
||
|
for i in $ALLOWED_ENV; do
|
||
|
E="$E $i=${!i}"
|
||
|
done
|
||
![]()
17 years ago
|
|
||
18 years ago
|
# clean the environment and set up a new one
|
||
19 years ago
|
env - $E $EX
|