PHP Apache错误调度请求

时间:2017-10-05 21:02:01

标签: php apache webserver apache2

我在PHP中有一个应用程序,它返回给我:

[Thu Oct 05 22:10:59.351244 2017] [proxy_fcgi:error] [pid 3733:tid 139869435164416] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:46777] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:16:27.701213 2017] [proxy_fcgi:error] [pid 3732:tid 139869359630080] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:46988] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:21:52.971235 2017] [proxy_fcgi:error] [pid 3733:tid 139869426771712] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47055] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:25:23.561216 2017] [proxy_fcgi:error] [pid 3732:tid 139869351237376] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47115] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:30:47.591237 2017] [proxy_fcgi:error] [pid 3733:tid 139869418379008] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47321] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:39:10.211214 2017] [proxy_fcgi:error] [pid 3733:tid 139869443557120] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47407] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:39:38.591259 2017] [proxy_fcgi:error] [pid 3733:tid 139869376415488] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47412] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:45:13.951238 2017] [proxy_fcgi:error] [pid 3733:tid 139869582505728] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47615] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:50:36.491214 2017] [proxy_fcgi:error] [pid 3732:tid 139869460342528] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47668] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:54:57.661219 2017] [proxy_fcgi:error] [pid 3733:tid 139869326059264] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47726] AH01075: Error dispatching request to : (polling)

我认为上述消息 - 以某种方式 - 与以下随机错误相关: enter image description here 请注意,XMLHttpRequests(AJAX调用)来自同一个域,有时不会执行上述错误。但是,通常它们会执行吗?

此消息来自哪个脚本以及如何解决?我只能想到一个可能超过默认最大执行时间的脚本,但是允许这个脚本运行更长时间,使用页面顶部的ini_set执行最长执行时间?

我不知道在哪里查看以及如何解决此问题

5 个答案:

答案 0 :(得分:5)

将以下行添加到httpd.confapache2.conf(取决于您的系统)文件中:

Timeout 600
ProxyTimeout 600

并重新启动apache

sudo /etc/init.d/apache2 restart

答案 1 :(得分:2)

我知道这个问题很老,但我在删除多个帖子时遇到了 worpress 这个问题,我发现很难找到解决方案,所以我(将来)和其他人一样为我放下这个问题同样的问题。

对于 CentOS 8,请确保您已安装 fast cgi 和可选的 php-fph

yum install mod_fcgid php-fpm

如果没有 php-fpm 编辑:

vi  /etc/httpd/conf.d/fcgid.conf

添加线条

FcgidIdleTimeout 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200

如果安装了php-fpm 编辑/创建:

vi /etc/httpd/conf.modules.d/00-proxy_timeout.conf

并添加行

imeout 1200
ProxyTimeout 1200

重启 php-fpm - 如果安装和 httpd

答案 2 :(得分:1)

我不确定错误,但很可能你的PHP代码应用程序花费了比配置的time.i更长的时间。建议使用CLI版本的PHP对此进行故障排除。

我可以肯定地说你的代码卡在某个循环中尝试使用PHP的CLI版本肯定会有所帮助。

答案 3 :(得分:1)

您可以将timeout=添加到ProxyPassMatch

ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800

看看here。希望这会有所帮助。

答案 4 :(得分:0)

<IfModule reqtimeout_module>

    # mod_reqtimeout limits the time waiting on the client to prevent an
    # attacker from causing a denial of service by opening many connections
    # but not sending requests. This file tries to give a sensible default
    # configuration, but it may be necessary to tune the timeout values to
    # the actual situation. Note that it is also possible to configure
    # mod_reqtimeout per virtual host.


    # Wait max 20 seconds for the first byte of the request line+headers
    # From then, require a minimum data rate of 500 bytes/s, but don't
    # wait longer than 40 seconds in total.
    # Note: Lower timeouts may make sense on non-ssl virtual hosts but can
    # cause problem with ssl enabled virtual hosts: This timeout includes
    # the time a browser may need to fetch the CRL for the certificate. If
    # the CRL server is not reachable, it may take more than 10 seconds
    # until the browser gives up.
    RequestReadTimeout header=20-40,minrate=500

    # Wait max 10 seconds for the first byte of the request body (if any)
    # From then, require a minimum data rate of 500 bytes/s
    RequestReadTimeout body=10,minrate=500

</IfModule>

以上似乎是Debian的默认设置-就我而言,我只需要修改这些值以增加假定的超时时间即可。