如何解决“;mod_fastcgi.c.2566文件意外结束(可能是fastcgi进程终止)“;当调用php时,执行需要


How to solve "mod_fastcgi.c.2566 unexpected end-of-file (perhaps the fastcgi process died)" when calling .php that takes long time to execute?

在我的php应用程序中,我恢复db2数据库。它运行良好,但这里有一个2.9GB的大容量,以500 - Internal Server Error结束。

我使用exec()从.php-cp、db2等运行unix shell命令。从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