How to Fix Fatal Error: max_execution_time Exceeded Error in WordPress
Are you getting a Fatal Error: max_execution_time exceeded message while using WordPress? No worries. It simply means that the PHP script you run takes longer to complete than the limit allows. Read on to find out how to solve this issue.
Solving Max Execution Time WordPress Error
There are three methods that you can use to fix the max execution time error in WordPress: editing the .htaccess file, changing the time limit via the control panel, and installing a plugin.
Manually Editing .htaccess File
By default, the max_execution_time is usually set to 30 seconds. If your PHP scripts need more time, then you need to edit the value in the .htaccess file.
Here’s how to do it:
- Open the File Manager in Hostinger’s hPanel and navigate to the public_html directory.
- Double-click the .htaccess file.
- Insert the following code into the bottom of your .htaccess file:
php_value max_execution_time 60
- Press Save and Close.
If you’re still getting the same error, you can try increasing the value to 120-180 seconds
Changing max_execution_time value via hPanel
You can also increase the WordPress max_execution_time directly from PHP Configurations in hPanel.
- Login to Hostinger’s hPanel and navigate to PHP Configurations under the Advanced section.
- Select the PHP Options tab and scroll down until you find the max_execution_time option.
- Increase the default value as needed and click Save.
That’s it — you have successfully increased the WordPress max_execution_time limit of your PHP script!
Installing a Plugin to Increase Execution Time Limit
An easy way to fix the WordPress max_execution_time error is by using a plugin. We recommend using Google Pagespeed Insights as it is straightforward and the developer updates it regularly.
- Install and activate the Google Pagespeed Insights plugin from your WordPress dashboard.
- Navigate to Tools -> Pagespeed Insights. Scroll down, find Advanced Configuration, and change the maximum execution time as needed. However, we recommend using the default settings as they will work fine on most websites.
- Click Save Options and the plugin will automatically modify the .htaccess file.
Should you want to undo any changes, simply deactivate the plugin and all the changes made to .htaccess will be removed.
You’ve learned three easy ways to fix the WordPress max_execution_time error. Here’s a quick recap of those methods:
- Insert the php_value max_execution_time 60 code into the .htaccess file.
- Extend the limit directly through PHP Configurations in hPanel.
- Increase the time limit by using Google Pagespeed Insights plugin.
There you have it, easy and quick fixes! If you’re using shared hosting services and none of the solutions worked for you, contact your hosting provider and ask if it’s possible to increase the maximum execution time. Good luck!