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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 03:09:35  来源:igfitidea点击:

Fatal error: Maximum execution time of 300 seconds exceeded

phpcommand-line-interface

提问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_timeand my max_input_timesettings in php.ini (both apache and cli) to 0, -1and 4000seconds each.

我已经尝试设置我max_execution_time和我的max_input_timephp.ini的(Apache和CLI)来0-14000秒每。

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.iniI am using.

我也检查了我的phpinfo()所以看看php.ini我正在使用哪个。

Even more interesting I have tried setting max_execution_timeand max_input_timesettings to 5 second and my script will run way beyond 5 seconds before I get the:

更有意思的我已经尝试设置 max_execution_timemax_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_timein php.inithen go to

增加max_execution_timeinphp.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.phpand 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 用户

  1. Go to xampp\phpMyAdmin\
  2. Open config.inc.php
  3. Search for $cfg['ExecTimeLimit'] = 300;
  4. Change to 0 for unlimited or set a larger value
  5. If not foundadd $cfg['ExecTimeLimit'] = 0;(or a larger value)
  6. Save the file and restart the server
  1. xampp\phpMyAdmin\
  2. 打开 config.inc.php
  3. 搜索 $cfg['ExecTimeLimit'] = 300;
  4. 更改为 0 表示无限制或设置更大的值
  5. 如果没有找到添加$cfg['ExecTimeLimit'] = 0;(或更大的值)
  6. 保存文件并重启服务器

回答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 设置。