Some scripts require some time to execute, and they might reach your PHP time limit.
If PHP time limit is too short for your script, you will see this error:
Fatal error: Maximum execution time of N seconds exceeded in /path/to/script.php on line N
PHP time limit can be configured in php.ini, open it up and change the following line to something more suitable:
(EDIT: Can’t find it? where is php.ini)
max_execution_time = 30
NOTE: PHP time limit is measured in seconds!
In order to enable PHP time limit, Apache needs to be restarted after php.ini has been edited.
Setting PHP time limit within a script
If you can’t edit your php.ini, or you want to set a time limit only for one script, you can set it with set_time_limit(N) function, which sets the time limit in seconds.
This will set to no time limit:
And this line to one minute:
NOTE: When dealing with resource-consuming operations, PHP might exceed the memory limit! However, other than PHP time limit, you can also set the PHP memory limit.