本文介绍了密集型PHP脚本失败,带有“指定的超时时间已到期"错误/ap_content_length_filter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行失败的MySQL密集型PHP脚本. Apache日志报告以下内容:

Running a MySQL intensive PHP script that is failing. Apache log reports this:

[Wed Jan 13 00:20:10 2010] [error] [client xxx.xx.xxx.xxxx] (70007)
The timeout specified has expired:
ap_content_length_filter: apr_bucket_read() failed,
referer: http://domain.com/script.php

尝试将set_time_limit(0)放在顶部.

也尝试过set_time_limit(0)

均未解决超时问题.

我可以在http.conf(或其他位置)中设置一些特定的超时限制来防止这种情况吗?

Is there some specific timeout limit I can up in http.conf (or elsewhere) to prevent this?

推荐答案

我也使用 Apache 2.4.6 PHP 5.4.23 FPM/FastCGI 强>.

无论我在PHP或Apache中设置什么,我的脚本都会在30秒后超时,并且我的Apache错误日志中会显示以下内容:

No matter what I set in PHP or Apache, my script would timeout in 30 seconds and I would see the following in my Apache Error log:

我的VirtualHost:

TimeOut  300
KeepAliveTimeout 300

<IfModule reqtimeout_module>
  RequestReadTimeout header=120-240,minrate=500
  RequestReadTimeout body=120,minrate=500
</IfModule>

<IfModule mod_proxy.c>
  ProxyTimeout 300
</IfModule>

<IfModule mod_fcgid.c>
  FcgidConnectTimeout 300
</IfModule>

讨厌的php脚本:

ini_set( 'max_execution_time', '120' );
...
ini_restore( 'max_execution_time' );

修复:这是Apache mod_proxy_fcgi

中的硬编码值

The Fix: it's a hard coded value in Apache mod_proxy_fcgi

  • 有一个补丁(上面的链接)
  • 该修复程序似乎尚未定于正式发布(2014年3月)
    • A patch is available (link above)
    • The fix doesn't appear to be slated for general release yet (Mar 2014)
    • 这篇关于密集型PHP脚本失败,带有“指定的超时时间已到期"错误/ap_content_length_filter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 16:23