Monday, June 11, 2012

Fatal error: Maximum Execution Exceeded in PHP

Problem: Using PHP you just encountered an error similar to the following:

Fatal error: Maximum execution time of 30 seconds exceeded

Solution: Just add these line of code in your PHP file

$durationInSeconds = 60;
ini_set('max_execution_time', $durationInSeconds);

The code above gives the maximum execution time of 60 seconds for your PHP script. Just be warned that your script may hog your system if it is running a heavy process for a long time.

In case you want your script to run in an unlimited amount of time, just set zero to $durationInSeconds:

$durationInSeconds = 0;
ini_set('max_execution_time', $durationInSeconds);

No comments:

Post a Comment