php 致命错误:超出最大执行时间 300 秒
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7680572/
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
Fatal error: Maximum execution time of 300 seconds exceeded
提问by dez
I keep getting this PHP error:
我不断收到此 PHP 错误:
Fatal error: Maximum execution time of 300 seconds exceeded
致命错误:超出最大执行时间 300 秒
I have tried setting my max_execution_time
and my max_input_time
settings in php.ini (both apache and cli) to 0
, -1
and 4000
seconds each.
我已经尝试设置我max_execution_time
和我的max_input_time
php.ini的(Apache和CLI)来0
,-1
和4000
秒每。
And i still get the error saying:
我仍然收到错误消息:
Fatal error: Maximum execution time of 300 seconds exceeded
致命错误:超出最大执行时间 300 秒
As well my script runs over 300 seconds before i get this message
在收到此消息之前,我的脚本也运行了 300 多秒
I am running the script through command line.
我正在通过命令行运行脚本。
I also checked my phpinfo()
so see which php.ini
I am using.
我也检查了我的phpinfo()
所以看看php.ini
我正在使用哪个。
Even more interesting I have tried setting max_execution_time
and max_input_time
settings to 5 second and my script will run way beyond 5 seconds before I get the:
更有意思的我已经尝试设置 max_execution_time
和max_input_time
设置至5秒,我的脚本将超出5秒办法之前,我得到:
Fatal error: Maximum execution time of 300 seconds exceeded
致命错误:超出最大执行时间 300 秒
采纳答案by Tules
At the beginning of your script you can add.
您可以在脚本的开头添加。
ini_set('MAX_EXECUTION_TIME', '-1');
回答by Vipin Dubey
If you are using WAMP Go to :
如果您使用 WAMP 转到:
Increase the max_execution_time
in php.ini
then go to
增加max_execution_time
inphp.ini
然后转到
C:\wamp\apps\phpmyadmin3.4.10.1\libraries
(change path according to your installation)
C:\wamp\apps\phpmyadmin3.4.10.1\libraries
(根据您的安装更改路径)
open config.default.php
and change value for $cfg['ExecTimeLimit']
to 0:
打开config.default.php
并将值更改为$cfg['ExecTimeLimit']
0:
$cfg['ExecTimeLimit'] = 0;
This will resolve the issue for PhpMyAdmin imports.
这将解决 PhpMyAdmin 导入的问题。
回答by Technotronic
Xampp Users
Xampp 用户
- Go to
xampp\phpMyAdmin\
- Open config.inc.php
- Search for
$cfg['ExecTimeLimit'] = 300;
- Change to 0 for unlimited or set a larger value
- If not foundadd
$cfg['ExecTimeLimit'] = 0;
(or a larger value) - Save the file and restart the server
- 去
xampp\phpMyAdmin\
- 打开 config.inc.php
- 搜索
$cfg['ExecTimeLimit'] = 300;
- 更改为 0 表示无限制或设置更大的值
- 如果没有找到添加
$cfg['ExecTimeLimit'] = 0;
(或更大的值) - 保存文件并重启服务器
回答by xiankai
I encountered a similar situation, and it turns out that Codeigniter (the PHP framework I was using) actually sets its own time limit:
我遇到了类似的情况,结果是Codeigniter(我使用的PHP框架)实际上设置了自己的时间限制:
In system/core/Codeigniter.php, line 106 in version 2.1.3 the following appears:
在 system/core/Codeigniter.php 中,版本 2.1.3 中的第 106 行出现以下内容:
if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
{
@set_time_limit(300);
}
As there was no other way to avoid changing the core file, I removed it so as to allow configuration through php.ini, as well as give the infinite maximum execution time for a CLI request.
由于没有其他方法可以避免更改核心文件,因此我将其删除以允许通过 php.ini 进行配置,并为 CLI 请求提供无限的最大执行时间。
I recommend recording this change somewhere in the case of future CI version upgrades however.
但是,我建议在将来 CI 版本升级的情况下在某处记录此更改。
回答by Darth Egregious
Try something like the following in your script:
在您的脚本中尝试类似以下内容:
set_time_limit(1200);
回答by llioor
This is the the right answer:
这是正确答案:
go to
去
c:\wamp\apps\phpmyadmin3.4.10.1\libraries\config.default.php
find and set
查找并设置
$cfg['ExecTimeLimit'] = 0;
restart all services and done.
重新启动所有服务并完成。
回答by Gaurav Arora
go to the xampp/phpmyadmin/libraries/config.default.php
转到 xampp/phpmyadmin/libraries/config.default.php
and make the following changes
并进行以下更改
from $cfg['ExecTimeLimit'] = '300′;
to $cfg['ExecTimeLimit'] = '0′;
回答by Rafiqul Islam
For Xampp Users
对于 Xampp 用户
1. Go to C:\xampp\phpMyAdmin\libraries
2. Open config.default.php
3. Search for $cfg['ExecTimeLimit'] = 300;
4. Change to the Value 300 to 0 or set a larger value
5. Save the file and restart the server
6. OR Set the ini_set('MAX_EXECUTION_TIME', '-1'); at the beginning of your script you can add.
回答by Zunnie Kanittika
For Local AppServ
对于本地应用服务
Go to C:\AppServ\www\phpMyAdmin\libraries\config.default.php
转到 C:\AppServ\www\phpMyAdmin\libraries\config.default.php
Find $cfg['ExecTimeLimit']
and set value to 0.
查找$cfg['ExecTimeLimit']
并将值设置为 0。
So it'll look like
所以它看起来像
$cfg['ExecTimeLimit'] = 0;
回答by Mob
PHP's CLI's default execution time is infinite.
PHP 的 CLI 的默认执行时间是无限的。
This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0.
这设置了脚本在被解析器终止之前允许运行的最长时间(以秒为单位)。这有助于防止编写不当的脚本占用服务器。默认设置为 30。从命令行运行 PHP 时,默认设置为 0。
http://gr.php.net/manual/en/info.configuration.php#ini.max-execution-time
http://gr.php.net/manual/en/info.configuration.php#ini.max-execution-time
Check if you're running PHP in safe mode, because it ignores all time exec settings when on that.
检查您是否在安全模式下运行 PHP,因为它会忽略所有时间 exec 设置。