这个简单的测试,调用set_time_limit 10次:
<?php
echo("<html><head><title>set_time test</title></head><body><h1>set_time test</h1>");
for ($i=0; $i<10; $i++) {
error_log("Round $i");
set_time_limit(0); echo("<p>$i</p>");
}
echo("</body></html>");
永远挂起错误:
// Fatal error: Maximum execution time of 30 seconds exceeded in .../_set_time.php on line 4
// Call Stack:
// 0.0007 231768 1. {main}() .../_set_time.php:0
// 0.0007 232000 2. set_time_limit() .../_set_time.php:4
30秒是max_execution_time
中php.ini
的值。如果我把它提高到3000,那么脚本就会继续旋转。我在apache的配置中有文件根的AllowOverrideAll(假设它很重要 - 它不应该,但仍然)
类似的机器(相同的OS&amp; SW版本,配置非常接近)每次都能完美地运行脚本。日志文件没有显示。谷歌搜索大多是默默无闻或无关紧要的。似乎有些奇怪的系统/配置怪癖。
想法?
操作系统:CentOS 6.9
apache 2.2.15
php 5.6(webtatic RPM:php56w-5.6.30-1.w6.x86_64)
编辑:将错误提交到xdebug项目:https://bugs.xdebug.org/view.php?id=1457
答案 0 :(得分:0)
好的,所以罪魁祸首是xdebug扩展(安装在一台机器上但不安装在另一台机器上)。通过删除它(php56w-pecl-xdebug-2.5.3-1.w6.x86_64),不需要的行为消失了。有点棘手,花了两天多的时间来确定,缩小到set_time_limit并找到负责任的扩展。