我尝试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),那么我将开始选择 lightty 设置和 /etc/php5/cgi/*.ini 文件。
我目前正在运行 Nginx/spawn-fcgi/PHP5 设置,效果非常好。
您正在使用哪种 Ubuntu(cat /etc/issue)、哪种架构(uname -a)以及哪种 lighttpd/php/fastcgi 包(dpkg --list | egrep "lighttpd|fastcgi|php")?