php 出于安全原因已禁用 set_time_limit()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17434013/
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 12:52:32  来源:igfitidea点击:

set_time_limit() has been disabled for security reasons

phpapachewampexecution-time

提问by Michal Artazov

I need to set set_time_limit(0);in my PHP script but I get

我需要set_time_limit(0);在我的 PHP 脚本中进行设置,但我得到了

Warning:set_time_limit() has been disabled for security reasons

警告:出于安全原因已禁用 set_time_limit()

I already tried increasing max_execution_timeproperty in my php.ini with no effect. I'm running WAMP 2.4 with Apache 2.4.4 and PHP 5.4.12.

我已经尝试max_execution_time在我的 php.ini 中增加属性但没有效果。我正在使用 Apache 2.4.4 和 PHP 5.4.12 运行 WAMP 2.4。

EDIT: I'm running it on my localhost, not shared hosting

编辑:我在我的本地主机上运行它,而不是共享主机

采纳答案by Michal Artazov

OK looks like I was just stupid... I had .htaccess file in the root folder and due to that I was running the script not from my localhost but from shared hosting where obviously it failed... after removing the .htaccess it works fine!

好吧看起来我只是愚蠢...我在根文件夹中有 .htaccess 文件,因此我不是从我的本地主机而是从共享主机运行脚本,显然它失败了......删除 .htaccess 后它可以工作美好的!

回答by BudwiseЯ

It seems that set_time_limitis disabled in your php.ini's disable functions. Try if removing set_time_limitfrom there helps you.

似乎set_time_limit在您php.ini禁用功能中被禁用。尝试set_time_limit从那里移除是否对您有帮助。

回答by Fenton

Web hosting companies do this to prevent you from running very-long-running processes that could impact the availability of other websites sharing the server.

网络托管公司这样做是为了防止您运行可能影响共享服务器的其他网站的可用性的非常长时间运行的进程。

If you need to run on shared hosting, you'll need to find a way of doing what you need in smaller chunks.

如果您需要在共享主机上运行,​​则需要找到一种方法以较小的块完成所需的工作。