Ubuntu
Nginx Ubuntu PHP5 - 未找到 php-fastcgi.pid
我在 Ubuntu 10.04.4 TLS 伺服器上使用 PHP5 設置 Nginx,並按照以下說明進行操作 -
http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid
在我執行 /etc/init.d/php-fastcgi start 之前一切都很好,php-fastcgi 是一個腳本 -
#!/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
它給了我這個資訊 -
spawn-fcgi: opening PID-file '/var/run/php-fastcgi/php-fastcgi.pid' failed: No such file or directory
顯然文件夾中沒有php-fastcgi.pid,更奇怪的是,/var/run中沒有php-fastcgi文件夾,我通過這個命令安裝了php -
apt-get install php5-cli php5-cgi spawn-fcgi psmisc
那麼有什麼問題嗎?謝謝。
創建缺少的目錄並使其可由 Web 伺服器使用者寫入:
sudo mkdir /var/run/php-fastcgi/ sudo chgrp www-data /var/run/php-fastcgi/ sudo chmod 0770 /var/run/php-fastcgi/