PHP 最大执行时间:报告不正确?

发布于 2024-08-12 11:34:49 字数 790 浏览 3 评论 0原文

PHP 脚本是否有任何原因返回以下致命错误:

Fatal error: Maximum execution time of 60 seconds exceeded in 
H:\xampplite\htdocs\mlm\tera.php on line 1

当我的 PHP ini 设置为“300000”时,我在脚本本身中设置了 set_time_limit(300000); 。安全模式已关闭。另外,Apache的超时时间也被设置为“300000”。

为什么 PHP 会返回这个 - 我很高兴听到为什么会发生这种情况!

我使用这个 PHP 脚本主要是使用 exec 函数通过 SQLCMD 运行查询。在 PHP 脚本执行(据说)超过 5 分钟后,我收到此错误。

注意:在回答这个问题时,请假设我毫无疑问使用了正确的 PHP.ini 文件等,并且我所声称的是实际发生的事情

帮助

感谢大家的 我以前问过这个问题,但认为另一个问题变得混乱。我把这一点说得更具体,希望我最终能就此结束这本书。这也是我做过的测试,我不再使用 AJAX。

更新

相关脚本的第 1 行:(

session_start(); 
ini_set("max_execution_time" , 300000); 
error_reporting(0);
ini_set('display_errors', '0');

我添加了换行符以使其更易于阅读)

Is there any reason for a PHP script to return a fatal error of:

Fatal error: Maximum execution time of 60 seconds exceeded in 
H:\xampplite\htdocs\mlm\tera.php on line 1

When my PHP ini is set to "300000" and further more I set set_time_limit(300000); in the script itself. Safemode is off. In addition, Apache's timeout has also been set to "300000".

Why would be PHP return this - I am happy to hear any case why this would happen!!

I am using this PHP script mainly to run queries via SQLCMD using the exec function. I get this error after the PHP script has been executing (supposedly) for well over 5 minutes.

Note: When answering this question please assume there is no doubt that I am using the right PHP.ini file etc and what I am claiming is what is actually happening.

Thanks all for any help

P.S. I have asked this question before but thought the other question was getting messy. I have made this more specific in the hope that I can finally close the book on this. Also this a test that I have done and I am not using AJAX any more.

Update

Line 1 of Script in question:

session_start(); 
ini_set("max_execution_time" , 300000); 
error_reporting(0);
ini_set('display_errors', '0');

(I have added a line break to make it easier to read)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

小ぇ时光︴ 2024-08-19 11:34:49

我在 php.net 上发现了此评论 。您的脚本等待来自其他地方的输入(例如文件上传)是否可能超过 60 秒? 60 是 max_input_time 的默认时间,它设置 PHP 等待接收文件数据的时间。

I found this comment on php.net. Is your script waiting for input from somewhere else (like a file upload) that might be exceeding 60 seconds? 60 is the default time for max_input_time, which sets how long PHP will wait to receive file data.

噩梦成真你也成魔 2024-08-19 11:34:49

phpinfo 输出是否实际显示您在相应列中作为 max_execution_time 输入的值 (300000)?没有不同的本地设置吗?整个 phpinfo 输出中没有任何地方有“60 秒”,对吗?

我不得不问,因为同样的事情不止一次发生在我身上。

那么,我们看到的是否是您从主脚本执行的另一个脚本的命令行输出?或者来自不同上下文的 PHP 脚本实际输出此内容的其他方式?

Is the phpinfo output actually showing the value you entered (300000) as the max_execution_time in the appropriate column? There is no differing local setting? There is no "60 seconds" anywhere in the whole phpinfo output, right?

I have to ask because the same thing has happened to myself more than once.

Then, could it be that what we are seeing is the command line output from a different script that you are executing from your main script? Or some other way that a PHP script from a different context is actually outputting this?

揽清风入怀 2024-08-19 11:34:49

使用简单的 php_info() 运行页面;呼叫作为唯一的线路。这将告诉您真正为最大执行时间设置的变量。

run a page with a simple php_info(); call as the only line. that will tell you what variable is really set for max execution time.

束缚m 2024-08-19 11:34:49

执行时间限制适用于php执行时间,不包括等待外部程序或数据库。这可以解释为什么 5 分钟后就达到了 60 秒的限制。

至于为什么你仍然受到 60 秒的限制,我不知道。听起来您确定使用了正确的 php.ini 文件,我会检查 .htaccess 文件中的 php 指令并使用 phpinfo() 检查设置。更改配置中的值并验证它在 phpinfo() 中的更改。

还要重新启动您的网络服务器。

The execution time limit applies to php execution time, and doesn't include waiting for external programs or databases. That would explain why you're hitting the 60 second limit after over 5 minutes.

As for why you're still getting the 60 second limit, I don't know. It sounds like you're sure you are using the correct php.ini file, i'd check any .htaccess files for php directives and check the setting with phpinfo() . Change a value in the config and verify it changed in phpinfo().

Also restart your webserver.

谎言月老 2024-08-19 11:34:49

您是否尝试过将 max_execution_time 设置为稍低一些的值(例如 300)?或者您真的需要三天半的执行时间吗? (提示:如果答案是肯定的,PHP 可能不是该工作的工具)一些快速谷歌搜索没有返回任何结果,但如果 300,000 超出了 PHP 或 apache 中的某些硬编码限制,我不会感到惊讶。我已经运行到 500 了,没有出现任何问题,但从来没有超过这个值。

Have you tried setting max_execution_time to something a little lower like 300? Or do you really need three and a half days of execution time? (hint: if the answer is yes, PHP is probably not the tool for the job) Some quick googling didn't return any results, but I wouldn't be surprised if 300,000 exceeded some hard-coded limit in PHP or apache. I've run it as high as 500 without problems, but never more than that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文