Php apache proxy_fcgi-指定的超时已过期-发送请求时出错
我有一个PHP应用程序,它返回我:Php apache proxy_fcgi-指定的超时已过期-发送请求时出错,php,apache,webserver,apache2,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.701
[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)
我认为上述信息在某种程度上与以下随机错误有关:
注意,XMLHttpRequests(AJAX调用)来自同一个域,有时不会执行上述错误。然而,通常它们会执行吗
此消息来自哪个脚本?我如何修复它?我能想到的只有一个脚本可能会超过默认的最大执行时间,但是允许该脚本运行更长的时间,使用页面顶部的ini_设置最大执行时间
我不知道在哪里查找以及如何修复此问题,我不确定是否存在此错误,但很可能您的PHP代码应用程序花费的时间比配置的时间长。我建议使用CLI版本的PHP对此进行故障排除
我可以肯定地说,您的代码陷入了某种循环,尝试使用CLI版本的PHP肯定会有所帮助。将以下行添加到
httpd.conf
或apache2.conf
(取决于您的系统)文件中:
然后重新启动apache
sudo /etc/init.d/apache2 restart
您可以将
timeout=
添加到ProxyPassMatch
中
ProxyPassMatch^/(.+\.php.*)$fcgi://127.0.0.1:9000//$1超时=1800
看看。希望这会有帮助。
<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>
#mod_reqtimeout限制客户端等待的时间,以防止
#攻击者通过打开多个连接来阻止拒绝服务
#但不发送请求。此文件试图给出合理的默认值
#配置,但可能需要将超时值调整为
#实际情况。请注意,还可以配置
#每个虚拟主机的mod_reqtimeout。
#请求行+头的第一个字节最多等待20秒
#从那时起,要求最低数据速率为500字节/秒,但不要
#总共等待超过40秒。
#注意:在非ssl虚拟主机上,较低的超时可能有意义,但也可能
#导致启用ssl的虚拟主机出现问题:此超时包括
#浏览器可能需要获取证书的CRL的时间。如果
#无法访问CRL服务器,可能需要10秒以上
#直到浏览器放弃。
RequestReadTimeout标头=20-40,最小速率=500
#请求正文的第一个字节(如果有)最多等待10秒
#从那时起,要求最低数据速率为500字节/秒
RequestReadTimeout正文=10,最小速率=500
以上似乎是Debian的默认设置-在我的例子中,我只需要修改这些值以增加假定的超时时间。我知道这个问题很老,但我在执行多次post删除时遇到了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
imeout 1200
ProxyTimeout 1200
如果安装了php fpm
编辑/创建:
vi /etc/httpd/conf.modules.d/00-proxy_timeout.conf
然后添加行
FcgidIdleTimeout 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200
imeout 1200
ProxyTimeout 1200
重新启动php fpm-如果已安装和httpdphp/JS代码示例?-你看到了吗?你使用的是什么版本的
php
?您是否尝试过将apache.conf
settingsTimeOut
和ProxyTimeout
的值增加到一个比它们已有的值更大的值?这与超时无关,因为它会在几次之后工作。后来我再也没有收到过这个警告,直到一个突然的时间,它不是由于超时。这似乎发生在服务器非常忙的时候。因为脚本在几秒钟/分钟后执行得很好?如果服务器很忙,那么很可能是由于超时而没有解决我的问题。在ubuntu上使用Apache2.4。