【问题标题】:Script timed out before returning headers: php.fastcgi脚本在返回标头之前超时:php.fastcgi
【发布时间】:2012-06-27 12:14:13
【问题描述】:

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

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

【问题讨论】:

  • 一般来说,我必须质疑任何需要 90 年代才能响应的 Web 请求是否明智。最终用户可能会在此超时之前很长时间感到无聊并退出浏览器屏幕。这样长的请求可以更好地优化,移动到批处理 Q 或使用 Refresh HTTP 标头进行伪批处理以强制定期重新轮询和进度更新。
  • @TerryE 如果用户是运营网站的公司的管理员或员工怎么办?如果这是由运营该网站的公司的员工执行的昂贵交易怎么办?您是对的,等待超过 90 秒是不可接受的,但请考虑其他用户类型,而不仅仅是网站的常规访问者。

标签: php performance fastcgi


【解决方案1】:

在您的 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 就完成了。

【讨论】:

    【解决方案2】:

    您可以在 PHP 脚本中调用set_time_limit(0); 以获得无限时间限制。

    【讨论】:

      猜你喜欢
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-08
      • 1970-01-01
      • 2014-10-18
      相关资源
      最近更新 更多