gpt4 book ai didi

PHP CLI 脚本没有超时

转载 作者:太空宇宙 更新时间:2023-11-04 09:07:51 25 4
gpt4 key购买 nike

我们有一个运行命令的node js脚本来执行以下命令:

/usr/local/bin/php -q /home/www/441.php {"id":"325241"}

这个脚本做了很多事情,但是它似乎没有遵守时间限制。该文件的第一行是:

set_time_limit(1800);

然而,如果我们检查服务器上正在运行哪些进程 (ps -aux | grep php),我们将看到自上周以来已打开的许多此类命令。

关于我们如何清理它有什么想法吗?

最佳答案

我在 PHP 用户指南中找到了以下关于 max_execution_time 的评论

Keep in mind that for CLI SAPI max_execution_time is hardcoded to 0. So it seems to be changed by ini_set or set_time_limit but it isn't, actually. The only references I've found to this strange decision are deep in bugtracker (http://bugs.php.net/37306) and in php.ini (comments for 'max_execution_time' directive).

因此 CLI 模块中似乎存在一个错误,这意味着 max_execution_time 被有效地忽略了。

评论者在 http://bugs.php.net/37306 提到了错误跟踪器中的一个页面。但跟踪器似乎已关闭。

关于PHP CLI 脚本没有超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6408925/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com