0

我正在尝试从 CLI 运行 php 脚本,如下所示:

php -q /var/www/script.php

据我所知,如果您从 CLI 运行它,则没有 max_execution_time,但是如果我使用必需/包含文件中的函数,则在 5-10 分钟后出现致命错误:

PHP 致命错误:在第 10 行的 /var/www/include.php 中超过了 60 秒的最大执行时间

所以 max_execution_time 不适用于包含的文件?在每个包含的文件中不添加 set_time_limit(0) 就可以避免这种情况吗?

4

2 回答 2

1

Perhaps one of the included files set (for whatever reason) a set_time_limit(60)? If that's the case, you could probably work around it by calling set_time_limit(0) after every include in your PHP CLI script... Or edit the files contaning the set_time_limit(60), which might of course lead to unwanted side effects...

于 2013-06-24T13:54:23.053 回答
0

尝试这个?

php -d max_execution_time=5 script.php
于 2013-06-24T13:35:48.310 回答