脚本在返回标头之前超时:php.fastcgi


Script timed out before returning headers: php.fastcgi

大约 90 秒后,我在 apache 错误日志中看到此错误。我断言我需要在 PHP 中增加一个设置,但我不确定要更改哪一个。

我可以增加一个设置来清除此错误吗?

php.ini文件中查找如下内容:

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 600    
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts. 
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 600

编辑值,重新启动 apache,您就完成了。

您可以在 PHP 脚本中无限期地调用 set_time_limit(0);