timeout - 调用.php执行时间长出现 "mod_fastcgi.c.2566 unexpected end-of-file (perhaps the fastcgi process died)"如何解决?

标签 timeout php

在我的 php 应用程序中,我恢复了 db2 数据库。它工作正常,但这里有一个 2.9GB 的大文件,它以 500 - Internal Server Error 结尾。

我使用 exec() 从 .php 运行 unix shell 命令 - cp、db2 等。从 firefox 或 ruby​​ 脚本运行时会发生同样的错误。

我必须先复制备份图像文件,这需要几分钟时间。然后我调用 db2 来恢复图像。对于这个特定的数据库,php 进程以上述错误结束。然后我可以在错误日志文件中找到这个

2012-08-02 10:25:18: (mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: tcp:127.0.0.1:9090
2012-08-02 10:25:18: (mod_fastcgi.c.3352) response not received, request sent: 2758 on socket: tcp:127.0.0.1:9090 for /wrational/tools/rationalTest.php?mode=restore&database=RATIONAL&from_database=dbb&dbbackuptype=weekly, closing connection

我在 php.ini 中将 default_socket_timeoutmax_execution_time 都设置为 5660,并确认它是由 phpinfo() 设置的,但它不是看起来没有帮助。

知道如何让这个工作正常吗?

更新

它看起来像是在 40 分钟后死亡。 access.log 文件中的相应行看起来像

"GET /rational/tools/rationalTest.php?mode=restore&from_database=dbb&dbbackuptype=weekly HTTP/1.1" 500 369 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0"

最佳答案

看起来问题出在 php-fpm.ini 中的 request_terminate_timeout 选项。它被设置为30分钟。我将其更改为 0,目前看起来还不错。不过需要做更多的测试。

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.  
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0

关于timeout - 调用.php执行时间长出现 "mod_fastcgi.c.2566 unexpected end-of-file (perhaps the fastcgi process died)"如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11769543/

相关文章:

javascript - 如果 Angular 超时返回 false,则重试函数调用

php - 在子目录中部署 yii2

php - 如何在mysqli中做mysql_fetch_assoc?

c# - 执行 POST 时无法将 HttpWebRequest 超时设置为高于 100 秒?

javascript - react 空闲定时器: Video Player Activity Detected as Idle

delphi - 如何在超时的单独线程中发出 HTTP 请求?

java - Curator 与 Zookeeper 服务发现连接被强制关闭

php - 如何使用 PHP 连接到 db4free.net 数据库?

php - 多个复选框插入

php - 连接到 socket.io 服务器的 easyRTC 错误