1

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.

  • It doesn't exist, did you mean I should create one? – Tom Jan 21 '13 at 18:38
  • Can u answer the question, and then I can choose your answer? – Tom Jan 21 '13 at 18:43
1

Create the missing directory and make it writable by the web server user:

sudo mkdir /var/run/php-fastcgi/
sudo chgrp www-data /var/run/php-fastcgi/
sudo chmod 0770 /var/run/php-fastcgi/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.