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 debug this WordPress issue.

Download all in one WordPress cheat sheet

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:

  1. Open the File Manager in Hostinger’s hPanel and navigate to the public_html directory.
  2. Double-click the .htaccess file.
  3. Insert the following code into the bottom of your .htaccess file:
    php_value max_execution_time 60
  4. Press Save and Close.

Pro Tip

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.

  1. Login to Hostinger’s hPanel and navigate to PHP Configurations under the Advanced section.
  2. Select the PHP Options tab and scroll down until you find the max_execution_time option.
  3. 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.

  1. Install the plugin for Google Pagespeed Insights from your WordPress dashboard and activate it.
  2. 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.this image shows you the advanced settings of Google PageSpeed Plugin
  3. 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.

Conclusion

You’ve learned three easy ways to fix the WordPress max_execution_time error. Here’s a quick recap of those methods:

  1. Insert the php_value max_execution_time 60 code into the .htaccess file.
  2. Extend the limit directly through PHP Configurations in hPanel.
  3. 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!

Author
The author

Elvinas S.

Elvinas is a senior server administrator at Hostinger. He monitors the infrastructure’s well-being and keeps the uptime at a maximum. Besides server management, web development has always been one of his biggest passions.