
我嘗試使用mod_fastcgi
以下配置在我的 lighttpd 伺服器(在 Ubuntu 上運行)中啟用(直接來自 中的範例conf-available
):
fastcgi.server = ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 2,
"idle-timeout" => 20,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)
……但現在 lighttpd 無法啟動,日誌中顯示以下內容:
2010-09-06 17:13:39: (log.c.166) server started
2010-09-06 17:13:39: (mod_fastcgi.c.1104) the fastcgi-backend /usr/bin/php-cgi failed to start:
2010-09-06 17:13:39: (mod_fastcgi.c.1108) child exited with status 2 /usr/bin/php-cgi
2010-09-06 17:13:39: (mod_fastcgi.c.1111) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version. If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2010-09-06 17:13:39: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed.
2010-09-06 17:13:39: (server.c.931) Configuration of plugins failed. Going down.
我怎麼知道出了什麼問題並解決它?
答案1
我會看看是否可以提供幫助,但請記住,我沒有輕型設置,因此無法一對一進行比較。
我想你應該看看你的 php-cgi 是如何配置的以及它支援什麼。所以...也許從類似的事情開始...
$ which php-cgi
/usr/bin/php-cgi
$ /usr/bin/php-cgi -m
[PHP Modules]
bcmath
bz2
calendar
cgi-fcgi
...
那麼也許:
$ /usr/bin/php-cgi -i > phpcgi.html
然後,在瀏覽器中開啟 phpcgi.html。我懷疑 phpcgi.html 和 phpcgi -m 都應該有提到“cgi-fcgi「 或者伺服器 API CGI/FastCGI, ETC。
如果這兩個看起來都不錯(即,看起來它的設定是支援 CGI),那麼我將開始選擇輕型設定和 /etc/php5/cgi/*.ini 檔案。
我目前正在運行 Nginx/spawn-fcgi/PHP5 設置,效果非常好。
您正在執行哪個 Ubuntu (cat /etc/issue)、哪個架構 (uname -a) 以及哪個 lighttpd/php/fastcgi 軟體包 (dpkg --list | egrep "lighttpd|fastcgi|php")?