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
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.
Xampp Users
xampp\phpMyAdmin\
$cfg['ExecTimeLimit'] = 300;
$cfg['ExecTimeLimit'] = 900;
(or 0 for unlimited)Important: setting the execution time limit to unlimited is not recommended.
At the beginning of your script you can add.
ini_set('MAX_EXECUTION_TIME', '-1');
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With