PHP和mod_fcgid:ap_pass_brigade失败handle_request_ipc功能 [英] PHP and mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

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

问题描述

这已被要求,并回答了之前 http://stackoverflow.com/a/12686252/219116 但是,在解决方案有没有为我工作。

mod_fcgid配置

 < IfModule mod_fcgid.c>
  AddHandler的fcgid脚本.fcgi
  FcgidIPCDir在/ var /运行/ mod_fcgid /
  FcgidProcessTableFile在/ var /运行/ mod_fcgid / fcgid_shm  FcgidIdleTimeout 60
  FcgidProcessLifeTime 120
  FcgidMaxRequestsPerProcess 500
  FcgidMaxProcesses 150
  FcgidMaxProcessesPerClass 144
  FcgidMinProcessesPerClass 0
  FcgidConnectTimeout 30
  FcgidIOTimeout 600
  FcgidIdleScanInterval 10
  FcgidMaxRequestLen 269484032< / IfModule>

PHP-CGI脚本

 #!/ bin中/ bassh
出口PHPRC = /无功/网络/虚拟主机/ example.com的/ etc /
出口PHP_FCGI_MAX_REQUESTS = 5000
EXEC在/ usr /斌/ PHP-CGI

系统的详细资料


  • 的CentOS Linux的发布1503年7月1日(核心)

  • 的httpd-2.4.6-31.el7.centos.x86_64

  • mod_fcgid-2.3.9-4.el7.x86_64

  • php56u-CLI-5.6.12-1.ius.centos7.x86_64

所以我的FcgidMaxRequestsPerProcess被设置为500,我的PHP_FCGI_MAX_REQUESTS设置为10倍,作为在previous答案和Apache文档建议。然而,我仍然得到这些错误

  [周四18年11月19日:16:48.197238 2015年] [fcgid:警告] [PID 6468:TID 139726677858048]
(32)管道中断:客户端X.X.X.X:41098] mod_fcgid:ap_pass_brigade在handle_request_ipc函数失败


解决方案

我也越来越大约一年同样的问题,当时我已经尝试了很多东西,去年我曾经文档阅读后做了一些肇事逃逸的事情我的问题是没有了。首先需要的重要的事情要设置为:

  FcgidBusyTimeout 300 [默认]
FcgidBusyScanInterval 120 [默认]

该指令的目的是为终止挂起应用即可。默认超时可能需要对于可以需要更长的处理请求的应用程序增加。因为检查是在由 FcgidBusyScanInterval 所限定的时间间隔,执行请求处理可以允许进行的时间更长的时间

  FcgidProcessLifeTime 360​​0 [默认]

已存在超过这个时间大于空闲的应用程序进程将被终止,如果processses为班级数超过 FcgidMinProcessesPerClass

这个过程一生检查是在频率上进行配置的 FcgidIdleScanInterval

  FcgidZombieScanInterval 3 [秒默认]

该模块检查在此时间间隔退出FastCGI应用。在这段时间里,应用程序可以在进程表存在,作为一个僵尸(Unix上)。

注:以上所有选项减少或增加,根据您的应用程序的时间,或需要或适用于特定的虚拟主机

但是,通过这个选项我的问题解决:

以上选项已经调整了我的服务器,但一段时间后,错误似乎正在添加一次,但错误是真的该解决:

  FcgidOutputBufferSize 65536 [默认]

我把它改为

  0 FcgidOutputBufferSize

这是模块将从FastCGI应用程序中的数据刷新到客户端之前读取响应数据的最大数量。这将刷新数据立即没有等待,有个字节的64KB,这真的帮助我更快冲洗过程。

其它问题我

如果500错误从Nginx的超时到来。解决方法:

/etc/nginx/nginx.conf

  keepalive_timeout 125;
proxy_read_timeout 125;
proxy_connect_timeout 125;
fastcgi_read_timeout 125;

间歇我会得到MySQL的MySQL服务器已消失的错误,这需要多一个好办法:
/etc/my.conf

  WAIT_TIMEOUT = 120

然后,只为funsies,我继续调升我的PHP内存限制,以防万一:
/etc/php.ini中

  memory_limit的= 256M

使用SuExe

的mod_fastcgi 不能在 Apache 2.X的所有在的SuExec 工作。我一无所有,但是从中麻烦(它也有在我们的测试其他许多问题)。你的问题的真正原因是的SuExec

在我的情况下,这是启动对我来说,我启动Apache,mod_fcgid滋生每个虚拟主机正好5进程。现在,使用一个简单的上传脚本和提交的文件比4-8KB大所有的子进程时,为特定的虚拟主机的脚本执行上被杀一次。

这也许可以使调试版本或杀青的mod_fcgid可能提供线索记录。

我试过的mod_fastcgi在此期间为1年,我也可以与许多人说的SuExec只不过是麻烦,运行平稳一点都没有,在任何情况下。

This has been asked and answered before http://stackoverflow.com/a/12686252/219116 but, the solution there is not working for me.

mod_fcgid config

<IfModule mod_fcgid.c>
  AddHandler    fcgid-script .fcgi
  FcgidIPCDir /var/run/mod_fcgid/
  FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

  FcgidIdleTimeout 60
  FcgidProcessLifeTime 120
  FcgidMaxRequestsPerProcess 500
  FcgidMaxProcesses 150
  FcgidMaxProcessesPerClass 144
  FcgidMinProcessesPerClass 0
  FcgidConnectTimeout 30
  FcgidIOTimeout 600
  FcgidIdleScanInterval 10
  FcgidMaxRequestLen 269484032

</IfModule>

php-cgi script

#!/bin/bassh
export PHPRC=/var/www/vhosts/example.com/etc/
export PHP_FCGI_MAX_REQUESTS=5000
exec /usr/bin/php-cgi

System details

  • CentOS Linux release 7.1.1503 (Core)
  • httpd-2.4.6-31.el7.centos.x86_64
  • mod_fcgid-2.3.9-4.el7.x86_64
  • php56u-cli-5.6.12-1.ius.centos7.x86_64

So my FcgidMaxRequestsPerProcess is set to 500 and my PHP_FCGI_MAX_REQUESTS is set to 10x that as suggested in the previous answers and the Apache documentation. And yet I still get these errors

[Thu Nov 19 18:16:48.197238 2015] [fcgid:warn] [pid 6468:tid 139726677858048]
(32)Broken pipe: [client X.X.X.X:41098] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

解决方案

I am also getting the same problem about a year back then I have tried many things and in last I have done some of the hit and run things after documentation reading and my problem is gone. First the important things required to be set as:

FcgidBusyTimeout     300 [default]
FcgidBusyScanInterval    120 [default]

The purpose of this directive is to terminate hung applications. The default timeout may need to be increased for applications that can take longer to process the request. Because the check is performed at the interval defined by FcgidBusyScanInterval, request handling may be allowed to proceed for a longer period of time

FcgidProcessLifeTime     3600 [default]

Idle application processes which have existed for greater than this time will be terminated, if the number of processses for the class exceeds FcgidMinProcessesPerClass.

This process lifetime check is performed at the frequency of the configured FcgidIdleScanInterval.

FcgidZombieScanInterval   3 [seconds default]

The module checks for exited FastCGI applications at this interval. During this period of time, the application may exist in the process table as a zombie (on Unix).

Note : All the above options Decrease or increase according to your application process time or needs or apply to specific vhost.

But My Problem resolve by this option:

Above options have tweaked my server but after some time the errors seems comming again but the error is really resolve by this:

 FcgidOutputBufferSize   65536 [default]

I have change it to

 FcgidOutputBufferSize   0

This is the maximum amount of response data the module will read from the FastCGI application before flushing the data to the client. This will flush the data instantly not waiting to have 64KB of bytes, which really helps me to flush out process more fast.

Other issues I got

if 500 Error coming from Nginx timing out. The fix:

/etc/nginx/nginx.conf

keepalive_timeout  125;
proxy_read_timeout 125;
proxy_connect_timeout 125;
fastcgi_read_timeout 125;

Intermittently I would get the MySQL "MySQL server has gone away" error, which required one more tweak: /etc/my.conf

wait_timeout = 120

Then, just for funsies, I went ahead and upped my PHP memory limit, just in case: /etc/php.ini

memory_limit = 256M

Using SuExe

mod_fastcgi doesn't work at all under SuExec on Apache 2.x. I had nothing but trouble from it (it also had numerous other issues in our testing). The real cause of your problem is SuExec

In my case that was a startup for me, I starting Apache, mod_fcgid spawns exactly 5 processes for each vhost. Now, when using a simple upload script and submitting a file larger than 4-8KB all of those child processes are killed at once for the specific vhost the script was executed on.

It might be possible to make debug build or crank up logging in mod_fcgid which might give a clue.

I tried mod_fastcgi in the meantime for 1 year and I too can say with many others that SuExec is nothing but troublesome and runs not smoothly at all, in every case.

这篇关于PHP和mod_fcgid:ap_pass_brigade失败handle_request_ipc功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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