脚本头过早结束:index.php、mod_fcgid:61 秒内读取数据超时
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14488567/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Premature end of script headers: index.php, mod_fcgid: read data timeout in 61 seconds
提问by Bilal Gultekin
I wrote a simple crawling script (in php) at localhost (with 4 variations). All of them worked fine at localhost. But when I made move them to shared hosting, two of them worked others gave internal server error. I looked at error_log and I saw these line:
我在本地主机上编写了一个简单的爬行脚本(用 php)(有 4 个变体)。所有这些都在本地主机上运行良好。但是当我将它们移动到共享主机时,其中两个工作了,其他人出现了内部服务器错误。我查看了 error_log 并看到了这些行:
[Wed Jan 23 22:01:02 2013] [warn] [client ***] mod_fcgid: read data timeout in 61 seconds
[Wed Jan 23 22:01:02 2013] [error] [client ***] Premature end of script headers: index.php
I searched but I couldn't find any useful result. What is related to these errors? Any ideas?
我进行了搜索,但找不到任何有用的结果。与这些错误有什么关系?有任何想法吗?
回答by trante
If you can access Linux server please edit /etc/httpd/conf.d/fcgid.conffile with vim.
Change FcgidIOTimeout 45to FcgidIOTimeout 600.
Restart Apache.
Then Fast CGI timeout will be solved.
如果您可以访问 Linux 服务器,请/etc/httpd/conf.d/fcgid.conf使用 vim编辑文件。
更改FcgidIOTimeout 45为FcgidIOTimeout 600。
重新启动阿帕奇。
那么Fast CGI 超时将被解决。
回答by user1193694
I had this problem on a MediaTemple Grid instance with a Drupal7 install; turns out it was being caused by FastCGI; switching to normal / stable CGI seems to have fixed the issue.
我在安装了 Drupal7 的 MediaTemple Grid 实例上遇到了这个问题;原来它是由 FastCGI 引起的;切换到正常/稳定的 CGI 似乎解决了这个问题。
回答by Ergec
If you're using virtual hosts (in my case i've ispconfig) you need to do changes in virtual host config files. These files are under /etc/httpd/conf/sites-availablefor each virtual host. Just edit your desired config file, locate IPCCommTimeoutand set current value to a higher number. You may need to do this change for both variables in same config file in case you have regular and SSL sites.
如果您使用的是虚拟主机(在我的情况下,我使用的是 ispconfig),您需要在虚拟主机配置文件中进行更改。这些文件位于/etc/httpd/conf/sites-available每个虚拟主机下。只需编辑您想要的配置文件,找到IPCCommTimeout当前值并将其设置为更高的数字。如果您有常规站点和 SSL 站点,您可能需要对同一配置文件中的两个变量进行此更改。
回答by CONvid19
Increase the max_execution_timevalue, i.e.:
增加max_execution_time值,即:
<?php
ini_set('max_execution_time', 300); # 5 minutes
...
回答by ?afak Gezer
mod_cfgid introduces other time limits besides PHP's max_execution_timewhile executing php scripts. Whichever comes first "wins".
mod_cfgidmax_execution_time在执行 php 脚本时引入了除 PHP 之外的其他时间限制。哪个先“赢”。
As far as I can see, there are numerous time limit configuration items that mod_cfgid considers, and I'm not the expert to tell which one does which, but at least in our case adding the following line
据我所知,mod_cfgid 考虑的时间限制配置项有很多,我不是专家来判断哪个做了哪个,但至少在我们的例子中添加了以下行
IPCCommTimeout 9999
in the fcgid.confsolved our unexpected timeout problems.
在fcgid.conf解决了我们意想不到的超时问题。
回答by Jason McCreary
read data timeout in 61 seconds
61 秒内读取数据超时
They timed out. It's likely your execution time is set to 60 seconds. So at 61 seconds, the process was killed and therefore had a premature end.
他们超时了。您的执行时间很可能设置为 60 秒。所以在 61 秒时,该进程被终止,因此过早结束。
You can adjust your timeout (not recommended) or run the script through another source (recommended).
您可以调整超时(不推荐)或通过其他来源运行脚本(推荐)。
回答by datasage
Essentially your scripts are running too long for the server configuration. mod_fcgid is waiting for php to respond, and its set to give up after 61 seconds. Since this shared hosting, you may not be allowed to change it.
本质上,您的脚本对于服务器配置来说运行时间过长。mod_fcgid 正在等待 php 响应,它设置为在 61 秒后放弃。由于此共享主机,您可能无法更改它。
This is not something that should be run via browser/web server anyway. Write it as a console script.
无论如何,这不应该通过浏览器/网络服务器运行。将其编写为控制台脚本。
回答by tquang
If any problem involve with mod_fcgid like below: _mod_fcgid: read data timeout in XX seconds _mod_fcgid: can't apply process slot for
如果 mod_fcgid 有任何问题,如下所示: _mod_fcgid:读取数据超时 XX 秒 _mod_fcgid:无法应用进程槽
Please fix these issues with priority:
请优先解决这些问题:
_Increasing the memory limit of php (default 128M, up to 256, 384, ... then restart apache anh check it again)
_Increasing the time out of FCGI, but not need if above is ok

