Nginx + FastCGI + PHP5 on FreeBSD 6.2
Peter Pluta
peter at placidpublishing.net
Wed Sep 5 18:04:37 PDT 2007
Has anyone sucessfully got this running? I haven't been able to get this to
work. I've looked at the numerous guides i've found on Google both in
Russian and in English. I'm trying to use php's default fastcgi spawner and
it's just not working. I've tried editing the bash script, but it won't
start (I changed few things around and changed it to sh). I'm pretty much
stumped now and want to just run it on Apache with mod_fcgid, but before I
do that I want to be sure I can't get it to work. :working:
Script:
#!/bin/sh
## ABSOLUTE path to the PHP binary
PHPFCGI="/usr/local/bin/php-cgi"
## tcp-port to bind on
FCGIPORT="9000"
## IP to bind on
FCGIADDR="127.0.0.1"
## number of PHP children to spawn
PHP_FCGI_CHILDREN=2
## number of request before php-process will be restarted
PHP_FCGI_MAX_REQUESTS=500
# allowed environment variables sperated by spaces
ALLOWED_ENV="PATH USER"
## if this script is run as root switch to the following user
USERID=nginx
################## no config below this line
if test x$PHP_FCGI_CHILDREN = x; then
PHP_FCGI_CHILDREN=5
fi
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_CHILDREN"
ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS"
ALLOWED_ENV="$ALLOWED_ENV FCGI_WEB_SERVER_ADDRS"
if test x$UID = x0; then
EX="usr/bin/su -c $USERID \"$PHPFCGI -q -b $FCGIADDR:$FCGIPORT\""
else
EX="$PHPFCGI -b $FCGIADDR:$FCGIPORT"
fi
echo $EX
# 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
nohup env - $E sh -c "$EX" &> /dev/null &
If anyone has a better method of getting it to work please do share it. I'd
like to get it to work and possibly write a small guide aim'd at FreeBSD
users.
Thanks,
Sasha
--
View this message in context: http://www.nabble.com/Nginx-%2B-FastCGI-%2B-PHP5-on-FreeBSD-6.2-tf4389129.html#a12513880
Sent from the freebsd-questions mailing list archive at Nabble.com.
More information about the freebsd-questions
mailing list