render() 在 60 秒后超时并显示 503 - 服务暂时不可用

render() times out after 60 seconds with 503 - Service Temporarily Unavailable

此代码在 CakePHP 4.3.3 模板中超时

503 - Service Temporarily Unavailable.

在 none-CakePHP 脚本中它起作用 [它在 6 分钟后显示 DONE]。

ini_set("max_execution_time", "0");
sleep(360);
die("DONE");

模板是这样调用的:

    $this->render("/General/index", "Study");

我没有找到关于渲染最大执行时间的任何信息,但由于我可以清楚地将其减少到上面的 MCVE,它一定与 CakePHP 相关,因为在 CakePHP 中它60 秒后停止,在 PHP 文件 timeout.php 中,直接放在 webroot 目录中,它有效。

我做错了什么,我没有正确设置什么?

我想,我应该出示日志条目:

[proxy_fcgi:error] [pid 1813:tid 140621247407872] (70007)The timeout specified has expired: [client XXXX:56968] AH01075: Error dispatching request to :

服务器在 Apache/nginx 下 运行。

我不明白为什么同一台服务器和同一域上的独立脚本可以工作,但在 CakePHP 下它 运行 进入超时 - 与完全相同的 3 行代码.

解决方案是 - 在调查日志错误后 - Apache2 Timeout

此外,我必须设置 nginx 超时设置:

proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
fastcgi_send_timeout 3600s;
fastcgi_read_timeout 3600s;

为 Apache 和 nginx 应用上述设置后,它在 CakePHP 下也能正常工作。