Are you searching for methods to increase PHP Time Limit in WordPress?
While working with WordPress, you will likely see the message ‘Maximum execution time of 30 seconds exceeded‘ or ‘Maximum execution time of 60 seconds exceeded‘
This message explains that the task executed is taking more extended time than the PHP has specified.
In this article, we will explain to you what is PHP Time Limit and show you some of the methods to increase PHP Time Limit.
What is PHP Time Limit?
As PHP is the core language of WordPress, there is a lot of PHP executions are going on in the background. To ensure that everything stays in order, WordPress developers add the PHP Time Limit.
PHP Time Limit caps the time that could be spent on one task to execute. If that script or code doesn’t load within that time limit, the PHP will display time out message.
If the operation is crucial to load the webpage, it will return the fatal error demonstrating that the PHP has run out of time.
You can easily increase that time. But, make sure the PHP operation shouldn’t take more than 3-4 seconds.
Also Read: Tutorial on How to Flush PHP Opcache
Increase PHP Time Limit by Using wp-config.php
You need to edit the wp-config.php file from the WordPress core folder.
Head on to your cPanel and open the File Manager. You can look for the wp-config.php in the root folder.
Edit the file and add the following line of code into it.
set_time_limit(300);
Now, click on the save button to save the changes made. Go back to your website and check whether it is still displaying the error message.
Increase PHP Time Limit using .htaccess
If you don’t prefer to make changes in the config.php file, you can increase the PHP Time Limit with the .htaccess file.
You can edit the .htaccess file from either the WordPress dashboard or an FTP utility, backend file manager.
Regardless of the method, you pick to edit the .htaccess file, you need to paste the below code into your .htaccess file.
max_execution 300
Save the changes made and check whether the error persists or is gone. In most cases, this method will resolve the error of the time limit.
Increase PHP Time Limit via PHP.ini File
Most of the shared hosting providers don’t let users access the PHP.ini file. In case, you are offered root access, you can straight away increase the PHP Time Limit with the PHP.ini file. If you want to elongate the limit to 300 seconds, you can insert the following line of code or update if the code is present already:
max_execution_time = 300;
Increase PHP Time Limit in cPanel
You can increase the PHP Time Limit even with a cPanel. You need to follow the below steps for PHP max execution time:
- Log in to your cPanel dashboard.
- Navigate to the Software section and then click on Select PHP Version.
- Click on the Options tab.
- Scroll down and search for max_execution_time and then click on the value field.
- Enter the desired value (should be in seconds) and wait for the value to get saved.
Suggested For Further Reading
- Advantages of cPanel for Your Reseller Hosting Account
- What is cPanel Web Hosting? : A Comprehensive Guide
Contact the Web Host
Often the web hosting provider doesn’t allow the users to increase PHP Time Limit.
If you are unable to resolve this error, you should contact your hosting provider.
Simply connect with your web hosting company. A quality hosting provider will do it for you gladly.
Conclusion
Receiving the error because of the low PHP time limit can be quite disturbing.
In this article, we mentioned the easiest methods to increase PHP time limit for your WordPress website.
Additionally, you can check out our Managed WordPress Hosting plans that promise to offer an optimal speed 99.9% uptime guarantee.