All pastes #191820 Raw Edit

Something

public text v1 · immutable
·published 2006-10-05 12:11 UTC
rendered paste body
#!/bin/bash

## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/usr/local/bin/spawn-fcgi"

## bind to tcp-port on localhost
FCGISOCKET="/home/www/fastcgi/domain.com/domain.com.socket"

## number of PHP childs to spawn
PHP_FCGI_CHILDREN=1

## number of request server by a single php-process until is will be restarted
PHP_FCGI_MAX_REQUESTS=1000

## IP adresses where PHP should access server connections from
FCGI_WEB_SERVER_ADDRS="127.0.0.1"

# allowed environment variables sperated by spaces
ALLOWED_ENV="PATH USER"

## if this script is run as root switch to the following user
USERID=www-domain.com
GROUPID=www-domain.com

################## no config below this line

if test x$PHP_FCGI_CHILDREN = x; then
  PHP_FCGI_CHILDREN=1
fi

export PHP_FCGI_MAX_REQUESTS
export FCGI_WEB_SERVER_ADDRS
export PHPRC

ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS PHPRC"

# copy the allowed environment variables
E=

for i in $ALLOWED_ENV; do
  E="$E $i=${!i}"
done

# clean environment and set up a new one
env - $E $SPAWNFCGI -s $FCGISOCKET -f "/usr/local/bin/php -c /usr/local/lib/php-xcache.ini" -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN

chmod 770 $FCGISOCKET