php 致命错误:超过了 0 秒的最大执行时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4869611/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:08:34  来源:igfitidea点击:

Fatal error: Maximum execution time of 0 seconds exceeded

phpcommand-line-interfaceexecution-timelitespeed

提问by kiler129

My script compares 2 source trees, creates a map of possible changed files, compares MD5 hashes and creates a diff-package.

我的脚本比较了 2 个源树,创建了可能更改的文件的映射,比较了 MD5 哈希值并创建了一个差异包。

After 28000-29000 files, PHP terminates the script with error:

在 28000-29000 个文件之后,PHP 终止脚本并出现错误:

Fatal error: Maximum execution time of 0 seconds exceeded in /root/_PACKER-TESTER/core/diff.class.php on line 67 (standard in_array() call)

致命错误:第 67 行的 /root/_PACKER-TESTER/core/diff.class.php 中超出了 0 秒的最大执行时间(标准 in_array() 调用)

I already tried to set max_input_timeto high value (or zero) - nothing.

我已经尝试设置max_input_time为高值(或零) - 没有。

Setting max_execution_timeto 99999999999999 do nothing .... the same error.

设置max_execution_time为 99999999999999 什么都不做......同样的错误。

采纳答案by kiler129

Problem solved, phpbuild with litespeed api (lsapi)has extra envvariable to determine maxexecute time - LSAPI_MAX_PROCESS_TIME(default is 300sec).

问题解决了,php构建litespeed api (lsapi)有额外的env变量来确定最大执行时间 - LSAPI_MAX_PROCESS_TIME(默认为 300 秒)。

回答by theamoeba

Try setting max_input_time = -1in php.ini, or using set_time_limit(-1). That worked for me without rebuilding PHP.

尝试max_input_time = -1在 中设置php.ini,或使用set_time_limit(-1). 这对我有用,而无需重建 PHP。

This articleexplains it nicely.

这篇文章很好地解释了它。

回答by Marc

Try set_time_limit()and check in phpinfo() if you are able to set the time limit:

尝试set_time_limit()并检查 phpinfo() 如果您能够设置时间限制:

set_time_limit(60*60);phpinfo();exit;

回答by Alan

I've found the "max execution time of 0 seconds exceeded" can be caused by the code going into an infinite loop.

我发现“超过 0 秒的最大执行时间”可能是由代码进入无限循环引起的。

For example:

例如:

while (true) { ... }

causes this error for me.

对我造成这个错误。

If it's not an environment variable (as mentioned previously) I would examine what's on the line number reported by php with the error

如果它不是环境变量(如前所述),我将检查 php 报告的行号上的内容,并显示错误