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条回答
Evening l夕情丶
2楼-- · 2020-01-26 02:33

At the beginning of your script you can add.

ini_set('MAX_EXECUTION_TIME', '-1');
查看更多
Melony?
3楼-- · 2020-01-26 02:34

In Codeignitor version 3.0.x the system/core/Codeigniter.php do not contain the time constraint as well as inserting

ini_set('MAX_EXECUTION_TIME', -1);  

will not work since codeignitor will override that with its own function set_time_limit() . So either you have to delete that function from codeignitor or simply you can insert

set_time_limit('1000');

in the beginning of the php file if you wanna change that to 1000 seconds. Set the time to 0 (zero) if you want to run it as long as it want.

查看更多
手持菜刀,她持情操
4楼-- · 2020-01-26 02:35

If you are using WAMP Go to :

Increase the max_execution_time in php.ini then go to

C:\wamp\apps\phpmyadmin3.4.10.1\libraries (change path according to your installation)

open config.default.php and change value for $cfg['ExecTimeLimit'] to 0:

$cfg['ExecTimeLimit'] = 0;

This will resolve the issue for PhpMyAdmin imports.

查看更多
兄弟一词,经得起流年.
5楼-- · 2020-01-26 02:35

If you are on xampp and using phpMyadmin to import large sql files and you have increased max_execution time, max file upload limit and everything needed And If none of the above answers work for you come here

Go to your xampp folder, in my case here is the relative path to the file that I need to modify: C:\xampp\phpMyAdmin\libraries\config.default.php

/** * maximum execution time in seconds (0 for no limit) * * @global integer $cfg['ExecTimeLimit'] * by defautlt 300 is the value * change it to 0 for unlimited * time is seconds * Line 709 for me */ $cfg['ExecTimeLimit'] = 0;

查看更多
乱世女痞
6楼-- · 2020-01-26 02:38

In my case, when I faced that error in Phpmyadmin, I tried MySQL-Front and import my DB successfully.

Note: You can still use the provided solutions under this question to solve your problem in Phpmyadmin.

查看更多
够拽才男人
7楼-- · 2020-01-26 02:38

On Xampp, in php.ini you must check mysql.connect_timeout either. So, for example, change it to:

mysql.connect_timeout = 3600

That time will be always counted in seconds (so 1 hour in my example)

查看更多
登录 后发表回答