【发布时间】:2012-03-02 16:11:47
【问题描述】:
错误日志中的 FastCgiIpcDir 问题
嗨,
我在我的 Apache 错误日志中注意到以下错误(错误 1):
[Wed Feb 08 14:00:06 2012] [alert] [client 41.185.88.175] (2)No such file or directory: FastCGI: failed to connect to (dynamic) server "/var/www/bin/php-splashpage-user/php-fastcgi": something is seriously wrong, any chance the socket/named_pipe directory was removed?, see the FastCgiIpcDir directive
紧接着是这个错误(错误2):
[Wed Feb 08 14:00:06 2012] [error] [client 41.185.88.175] FastCGI: incomplete headers (0 bytes) received from server "/var/www/bin/php-splashpage-user/php-fastcgi"
如何修复错误 1?
我了解到由于主机系统定期清除“/tmp”目录(如果未定义,则为 fastCgiIpcDir 的默认目录)并因此消除与当前活动的 FastCGI 服务的通信而更改此设置。所以我决定试一试。我在 fastcgi.conf 文件中设置了 FastCgiIpcDir 以希望成功,但根本没有任何变化。
这是我的 fastcgi.conf 文件的内容:
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/lib/apache2/fastcgi_test
FastCgiConfig -idle-timeout 60 -maxClassProcesses 1
FastCgiWrapper On
AddHandler php5-fcgi .php
Action php5-fcgi /cgi-bin/php-fastcgi
<Location "/cgi-bin/php-fastcgi">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
Options ExecCGI
SetHandler fastcgi-script
</Location>
</IfModule>
/var/lib/apache2/fastcgi_test 的权限和权限:
drwxr-xr-x 3 www-data www-data 4.0K 2012-02-08 09:20 fastcgi_test
我的 php 包装脚本 php_fastcgi 有以下几行:
#!/bin/sh
PHP_FCGI_CHILDREN=120
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_MAX_REQUESTS
umask 0022
exec /usr/bin/php-cgi -d apc.shm_size=50
我正在运行 PHP 5.3.1、Apache/2.2.14、Ubuntu 10.04。
到目前为止,我总结了以下几点:
- 错误 1 仅出现在一个小时的开始,比如新小时后的 6 秒
通过使用 mod_FastCgi,我了解到增加子进程有助于缓解一些“错误 2”错误(这会导致随机间隔的 HTTP 500 错误)。目前我不太确定错误 1 的影响是什么,但是如果错误 2 紧随其后,那么可以肯定地说这不是一件好事。
关于 Fastcgi 报告的错误的完整信息(如果有的话)的信息非常少,并提供了久经考验的解决方案。可悲的是,我可能只是在没有结论的情况下添加到网上发布的大量 Fastcgi 错误中。
您在解决错误 1 方面的帮助、建议或技巧将不胜感激。
【问题讨论】: