Fatal error: Maximum execution time of 300 seconds

2020-01-26 01:51发布

I keep getting this PHP error:

Fatal error: Maximum execution time of 300 seconds exceeded

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.

And i still get the error saying:

Fatal error: Maximum execution time of 300 seconds exceeded

As well my script runs over 300 seconds before i get this message

I am running the script through command line.

I also checked my phpinfo() so see which php.ini I am using.

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:

Fatal error: Maximum execution time of 300 seconds exceeded

18条回答
啃猪蹄的小仙女
2楼-- · 2020-01-26 02:12

If above answers will not work, try to check your code,,In my experience,having an infinite loop will also cause that problem.Check your else if statement.

查看更多
家丑人穷心不美
3楼-- · 2020-01-26 02:13

WAMP USERS:

1) Go to C:\wamp\apps\phpmyadmin

2) Open config.inc

3) Add $cfg['ExecTimeLimit'] = ’3600′; to the file.

4) Save the file and restart the server.

This file overwrites the php.ini and will work for you!

查看更多
Bombasti
4楼-- · 2020-01-26 02:15

MAMP USERS editing php.ini solves this - there is a line:

max_execution_time = 30 ; Maximum execution time of each script, in seconds

setting this to a higher value worked.

the file is in php/php5.6.25/conf/php.ini (obviousl you need to wet the file for the php version you are using - you can find this out from the MAMP preferences.

查看更多
霸刀☆藐视天下
5楼-- · 2020-01-26 02:17

I encountered a similar situation, and it turns out that Codeigniter (the PHP framework I was using) actually sets its own time limit:

In system/core/Codeigniter.php, line 106 in version 2.1.3 the following appears:

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.

I recommend recording this change somewhere in the case of future CI version upgrades however.

查看更多
forever°为你锁心
6楼-- · 2020-01-26 02:19

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.

查看更多
神经病院院长
7楼-- · 2020-01-26 02:22

For Local AppServ

Go to C:\AppServ\www\phpMyAdmin\libraries\config.default.php

Find $cfg['ExecTimeLimit'] and set value to 0.

So it'll look like

$cfg['ExecTimeLimit'] = 0;
查看更多
登录 后发表回答