What Is The PHP Time Limit?
The PHP Time Limit is the amount of time that your site will spend on a single operation before timing out.
PHP will timeout and exit with the following error once it reaches the maximum allowed time for it to execute your scripts;
Fatal error: Maximum execution time of 30 seconds exceeded in yourscript.php
You can avoid this error by increasing the maximum execution time for PHP. This can be set globally or from within your PHP scripts via any of these options;
1. Contact Your Host
Increasing the PHP Time Limit is complex and the process that differs from hosts to hosts. So it is always better to get it done from someone who knows it well. So just get in touch with your hosting company and they will be happy to do it for you.
2. Configuring php.ini
PHP time limit can be configured in php.ini, open it up and change the following line to something more suitable:
max_execution_time = 300
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.
3. Setting PHP time limit within wp-config.php
This is basically the same as the previous solution, but it’s actually a function that you call from your
PHP script. It’s a general function to override any configuration options set in your
PHP‘s configuration file and will only affect the execution of the scripts that call the function.
When placed at the start of your
PHP script, the following function call will allow it to run for 300 seconds (5 minutes).
4. Modifying the .htaccess file
Some of you might have the .htaccess file where you can simply add / edit this line of code to increase the time limit.