cPanel Apache在60秒后响应为空


cPanel Apache empty response after 60 seconds

我目前正试图增加PHP脚本的最长执行时间,但我不明白为什么Apache总是在60秒后返回空响应。

我已经增加了PHP的最大执行时间、最大发布大小和最大上传大小。我已经验证了Tweak设置和Apache设置,看看是否有与最大请求时间或超时的最大执行时间有关的东西。。。找不到任何东西。

也许这个问题与内存使用或其他什么有关,但我搞不清楚。

我有一个第三方模块,即Varnish,当我尝试使用Varnish完成请求时,一切都很好。否则,如果我禁用它(它当前已禁用),apache就无法返回响应。我从谷歌chrome:得到这个

未收到任何数据错误代码:ERR_EMPTY_REPONSE

PHP脚本是这样的:

<?php
    $timeInSeconds = 70;
    $start = microtime(true);
    $end = $start + $timeInSeconds;
    $diff = $end - $start;
    echo 'start: '.$start.'<br />';
    while ($start < $end)
    {
            $start = microtime(true);
    }
    echo 'end: '.$end.'<br />';
    echo 'difference: '.$diff;

使用命令行,一切正常。

转到WHM>>服务管理器>>Apache配置>>全局配置(我不知道正确的菜单名称,因为我的WHM在葡萄牙语上)并更改超时值。

你能用下面的脚本检查一下吗这将在运行时将输出缓冲区刷新到屏幕

<?php
$timeInSeconds = 70;
$start = microtime(true);
$end = $start + $timeInSeconds;
$diff = $end - $start;
echo 'start: '.$start.'<br />';
while ($start < $end)
{
    $start = microtime(true);
    echo $start;
    ob_flush();
    flush();
    sleep(1);
}
echo 'end: '.$end.'<br />';
echo 'difference: '.$diff;

有关flush的详细信息:http://php.net/manual/en/function.flush.php