I was setting-up Nginx with PHP5 on Ubuntu 10.04.4 TLS Server, and follow this instructions -
http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid
Everything is fine before I run /etc/init.d/php-fastcgi start, the php-fastcgi is a script -
#!/bin/bash
PHP_SCRIPT=/usr/bin/php-fastcgi
FASTCGI_USER=www-data
FASTCGI_GROUP=www-data
PID_DIR=/var/run/php-fastcgi
PID_FILE=/var/run/php-fastcgi/php-fastcgi.pid
RET_VAL=0
case "$1" in
start)
if [[ ! -d $PID_DIR ]]
then
mkdir $PID_DIR
chown $FASTCGI_USER:$FASTCGI_GROUP $PID_DIR
chmod 0770 $PID_DIR
fi
if [[ -r $PID_FILE ]]
then
echo "php-fastcgi already running with PID `cat $PID_FILE`"
RET_VAL=1
else
$PHP_SCRIPT
RET_VAL=$?
fi
;;
stop)
if [[ -r $PID_FILE ]]
then
kill `cat $PID_FILE`
rm $PID_FILE
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE"
RET_VAL=1
fi
;;
restart)
if [[ -r $PID_FILE ]]
then
kill `cat $PID_FILE`
rm $PID_FILE
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE"
fi
$PHP_SCRIPT
RET_VAL=$?
;;
status)
if [[ -r $PID_FILE ]]
then
echo "php-fastcgi running with PID `cat $PID_FILE`"
RET_VAL=$?
else
echo "Could not find PID file $PID_FILE, php-fastcgi does not appear to be running"
fi
;;
*)
echo "Usage: php-fastcgi {start|stop|restart|status}"
RET_VAL=1
;;
esac
exit $RET_VAL
and it give me this message -
spawn-fcgi: opening PID-file '/var/run/php-fastcgi/php-fastcgi.pid' failed: No such file or directory
Apparently there is no php-fastcgi.pid in the folder, even strange, there is no php-fastcgi folder in /var/run, I installed php by this command -
apt-get install php5-cli php5-cgi spawn-fcgi psmisc
So is there anything wrong? Thanks.
/var/run/php-fastcgi/
exist, and is it writable by thewww-data
user? – Christopher Jan 21 '13 at 17:52sudo mkdir /var/run/php-fastcgi/; sudo chgrp www-data /var/run/php-fastcgi/; sudo chmod 0770 /var/run/php-fastcgi/
should do it.) – Christopher Jan 21 '13 at 18:39