Skip to content
Advertisement

Fatal error: Maximum execution time of 300 seconds exceeded

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

Advertisement

Answer

At the beginning of your script you can add.

ini_set('MAX_EXECUTION_TIME', '-1');
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement