mod_fcgid + PHP + APACHE锁定 [英] mod_fcgid + PHP + apache lockup

查看:262
本文介绍了mod_fcgid + PHP + APACHE锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过mod_fcgid运行PHP的一个相当典型的LAMP堆栈。我会考虑的服务器被赋予它接收的流量高负荷下。

I'm running a fairly typical LAMP stack with PHP running through mod_fcgid. I'd consider the server to be under "high load" given the amount of traffic it receives.

有是一个间歇性问题,即Apache是​​报告所有连接在发送内容状态(在监视器上W)访问依赖于PHP站点时。

There is an intermittent problem, where Apache is reporting all connections to be in the "Sending content" state ("W" on the monitor) when accessing sites that rely on PHP.

有没有PHP错误可言,它好像PHP是不是真正得到在这些禁售期间调用。然而,在apache的网站日志我看到以下内容:

There are no PHP errors to speak of, its as though PHP isn't actually getting called during these "lockup" periods. However, in the apache site logs I'm seeing the following:

(103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
[warn] mod_fcgid: can't apply process slot for /var/www/cgi-bin/php.fcgi

在此期间,我可以不依赖于PHP还是访问网站,比如apache的状态和HTML的唯一虚拟主机(即没有PHP处理程序包括)。

During this time I can still access sites that do not depend on PHP, such as the apache status and HTML-only virtual hosts (that don't have the PHP handler include).

该php.fcgi脚本有 PHP_FCGI_MAX_REQUESTS = 500 集,因为我看过有一个与PHP CGI模式运行的竞争条件问题。该fcgid.conf也有 MaxProcessCount = 15 设置。

The php.fcgi script has PHP_FCGI_MAX_REQUESTS=500 set, because I have read there is a race condition problem with PHP running in CGI mode. The fcgid.conf also has MaxProcessCount=15 set.

有没有其他人遇到这个错误,如果是这样怎么能解决?

Has anyone else experience this bug, and if so how can it be resolved?

推荐答案

我设法解决这一个自己。

I managed to fix this one myself.

要解决这个问题,添加在过程中挂起FastCGI配置,严格的检查,并降低你的PHP实例的生命周期:

To solve this problem add in stricter checks in the FastCGI configuration for process hangs, and reduce the lifetime of your PHP instances:

IPCConnectTimeout 20
ProcessLifeTime 120
IdleTimeout 60
IdleScanInterval 30
MaxRequestsPerProcess 499
MaxProcessCount 100

根据您的要求,这能满足有超过每小时50公里的点击配置良好的服务器。

Depending on your requirements, this can satisfy a well-configured server that has in excess of 50k hits per hour.

您会发现记录解散/僵尸PHP进程的数目显著增加。这是好事,但由于previously过程会简直成了反应迟钝和FastCGI的经理会继续为管道请求他们!

You will find the number of recorded defunct / "zombie" PHP processes increases significantly. This is good, however, as previously the processes would have simply become unresponsive and the FastCGI manager would have continued to pipe requests to them!

我也建议您php.fcgi脚本中删除所有覆盖的指令,因为这可能会导致你的系统问题。尝试尽可能多地从Apache的主要FastCGI配置管理。

I would also advise removing all override directives from your php.fcgi script, as this can cause problems with your system. Try to manage as much as possible from the primary FastCGI configuration in Apache.

这篇关于mod_fcgid + PHP + APACHE锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆