PHP set_time_limit()不起作用,安全模式已关闭 [英] PHP set_time_limit() does not work, safemode is off

查看:1301
本文介绍了PHP set_time_limit()不起作用,安全模式已关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过以下方式禁用PHP脚本中的时间限制

I try to disable the time limit in an PHP script by

set_time_limit(0);

但是它不起作用;系统默认为30秒后,脚本仍将中止. max_execution_time设置-由set_time_limit(0)之后的phpinfo()显示-对于主值和本地值仍然显示30秒.它还表明安全模式已关闭.

but it does not work; the script is still aborted after the system default of 30 seconds. The max_execution_time setting - as displayed by phpinfo() after set_time_limit(0) - still shows 30 seconds for both Master and Local value. It also shows that Safe Mode is Off.

您知道出了什么问题吗?它是在Apache 2.2.15和CentOS 6.2上运行的PHP 5.3.3 (cli).

Do you have any idea what goes wrong? It's PHP 5.3.3 (cli) running on CentOS 6.2 with Apache 2.2.15.

推荐答案

我现在可以解决此问题.原因是

I was able to solve the problem now. The reason was

php_admin_value max_execution_time "30"

虚拟主机配置中的

....如果在此设置,则时间限制不能被PHP脚本覆盖.解决方案是在php.ini中而不是Apache config中进行设置-允许覆盖...

... within the virtual host configuration. If set there, the time limit cannot be overridden by a PHP script. And the solution is to set it either in the php.ini instead of Apache config - that allows override ...

max_execution_time = 30

或为apache配置中的某些目录定义例外,例如

or to define exceptions for certain directories within the apache config, e.g.

<Directory /path/to/my/scripts>
  php_admin_value max_execution_time "600"
</Directory>

我还尝试使用< Files>指令为单个文件定义例外,但这没有用.

I also tried to define exceptions for single files using the <Files> directive, but that did not work.

这篇关于PHP set_time_limit()不起作用,安全模式已关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆