Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Fix Fatal Error: Maximum Execution Time Exceeded in WordPress

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Are you seeing ‘Fatal error: Maximum execution time of 30 seconds exceeded’ on your screen when trying to update a WordPress plugin or theme?

Typically, this problem occurs when a PHP script in WordPress takes a long time to run and reaches the maximum time limit set by your WordPress hosting server. The time limit is important because it helps prevent the abuse of server resources.

In this article, we will show you how to fix the fatal error: maximum execution time exceeded in WordPress.

Fix Fatal Error: Maximum Execution Time Exceeded in WordPress Easily

Why Does the Maximum Execution Time Exceeded Error Happen?

The maximum execution time exceeded error happens in WordPress because PHP, the programming language behind WordPress, has a time limit for how long a script can run. This limit is in place to prevent web servers from being misused.

Different hosting companies set various time limits, but 30-60 seconds is often enough time. If a PHP script on your WordPress site takes longer than this set time, it triggers the maximum execution time exceeded error.

Maximum Execution Time of 30 Seconds Exceeded Error in WordPress

How to Fix the Maximum Execution Time Exceeded Error in WordPress

Although the maximum execution time exceeded error is called a ‘fatal error,’ it is actually one of the most common WordPress errors that are easy to fix.

Let’s look at how to fix the maximum execution time exceeded error in WordPress. You can use the links below to jump to the different troubleshooting methods:

Important: We recommend backing up your WordPress to prevent further errors from occurring on your website. Please read our guide on how to back up a WordPress website for more information.

Method 1: Use WordPress Recovery Mode

Depending on when and where the error is triggered, WordPress may show the ‘This site is experiencing technical difficulties’ error notification on the front end.

Technical difficulties

This is part of the fatal error protection feature added in WordPress 5.2.

You may also receive an email that will tell you which plugin (if a plugin triggered the error) caused the issue.

Technical issue email sent to admin

The email will also include a special link.

This will allow you to log in to WordPress using ‘Recovery mode’.

Recovery mode

Once there, you can simply deactivate or delete the plugin causing the error.

For more details, please see our guide on how to use WordPress recovery mode and how to deactivate WordPress plugins.

Method 2: Edit Your .htaccess File

This method is recommended for WordPress users who are unable to access their WordPress dashboard. To fix the maximum execution time limit error, you will need to manually edit your .htaccess file and add a simple line of code.

Simply connect to your website using an FTP client or the File Manager app in your cPanel or other web hosting dashboard.

Your .htaccess file is in the same folder as your /wp-content/ and /wp-admin/ folders. If you can’t find it, then see our article on why you can’t find the .htaccess file and how to find it.

For example, if you are using FileZilla as your FTP client, then you can find it in the ‘Remote Site’ section in the right-hand column.

WordPress .htaccess File in Filezilla

Once you find the .htaccess file, simply right-click it and select the ‘View/Edit’ option.

This will open the file within a text editor.

View/Edit .htaccess File in WordPress

Next, you need to add the following code at the bottom of your .htaccess file:

php_value max_execution_time 300

If you are using Notepad as your text editor, here is how it may look.

Once that is done, go ahead and save the file.

Adding Code to .htaccess File WordPress

This code simply sets the value for maximum execution time to 300 seconds (5 minutes). You can now visit your website to see if the error message is gone.

If you still get the error, then try increasing the value to 600.

If you found this method helpful, then check out the most useful .htaccess tricks for WordPress.

Method 3: Modify the php.ini File

Another method to fix the maximum execution time exceeded error in WordPress is by modifying your php.ini file.

The php.ini file is a configuration file that defines the settings for PHP on your server. On many WordPress hosting platforms, you may not see it inside your root folder.

In that case, you can create a new php.ini file inside your WordPress root folder using FTP or the File Manager app.

After that, simply edit the php.ini file and add the following line:

max_execution_time = 60

Don’t forget to save the file and upload your changes back to the server. You can now visit your website and to see if the error has gone.

Method 4: Edit Your wp-config.php File

This method differs slightly from editing the .htaccess file. While both increase the maximum execution time of your website, editing wp-config.php creates a setting that affects your entire server.

Like before, you should access your WordPress root directory using an FTP client or your web hosting control panel’s File Manager. Then, locate the wp-config.php file and open it for editing.

Paste the following line just before the line that says That's all, stop editing! Happy blogging.:

define('WP_MAX_EXECUTION_TIME', 300); // Replace 300 with your desired time in seconds

This code snippet defines a custom maximum execution time specifically for your WordPress site. We recommend starting with 300 to see if it fixes the error before adding more seconds.

Method 5: Optimize Your WordPress Database

A bloated database can sometimes slow down your website, potentially leading to the maximum execution time exceeded error. Regularly optimizing your database removes unnecessary data and improves your overall WordPress performance.

Thankfully, optimizing a database isn’t so technical anymore. You can read our guide on how to optimize your WordPress database with one-click for step-by-step instructions.

Method 6: Check Your WordPress Plugins

Plugins can be a double-edged sword. While they add functionality, some poorly coded plugins can consume excessive resources, leading to execution timeouts.

To identify a problematic plugin, you can temporarily deactivate all your plugins and see if the error disappears. If it does, then a plugin is likely the culprit.

Bulk deactivate all WordPress plugins

Now, reactivate the plugins one at a time, checking for the error after each reactivation. This helps pinpoint the specific plugin causing the issue.

If you can’t access the admin area, we have a guide on deactivating plugins even when you can’t access the wp-admin dashboard.

Once you identify the problematic plugin, reach out to the plugin author for support. Additionally, consider using trusted plugin repositories like WordPress.org and the WPBeginner Solution Center to find well-reviewed and optimized plugins for your needs.

WPBeginner's WordPress Solution Center

In most cases, increasing the maximum execution time using these methods will resolve the error. However, if it doesn’t, then you need to contact your WordPress hosting provider for assistance.

For more information about getting help for your WordPress site, read our guide on how to ask for WordPress support the right way.

Learn More Ways to Solve Common WordPress Errors

Experiencing other types of WordPress errors? These guides may be able to help you out:

We hope this article helped you fix the fatal error: maximum execution time exceeded in WordPress. You may also want to see our guide on how to fix the error establishing a database connection in WordPress and our top picks for the best managed WordPress hosting providers.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

71 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    What do you think is a reasonable maximum of this value? Sometimes some plugins, especially for import and export, need quite a lot of time before performing an action. So I would be interested in what value it is no longer good to get over, because it could mean, for example, a security risk.

    • WPBeginner Support says

      Starting with 60 is normally a good way to test and then it would depend on the specific task for how much to increase it or if the host needs to be checked with for an error.

      Admin

      • Jiří Vaněk says

        Thank you for answer. I currently have a limit of 300 and then that’s enough. So I’ll leave it at this value then we’ll see. When I put it lower, I sometimes don’t fit into the limits. Thank you. I will definitely not increase the limit then.

  3. mudasir abbas turi says

    when ever i have face with problem then i search on google i found your website and i have always solve my problem from your website thanks too much

    • WPBeginner Support says

      You would use the same method, you may want to ensure the file isn’t already created under xampp/php in which case you would want to edit the file there.

      Admin

  4. Umesh Vinayak Shejole says

    It’s working properly. I am installed premium shopping theme & got error when installing required plugins. After putting php_value max_execution_time 300 line in my .htaccess file it’s working & being installed all required plugin. I am trying from last 2 / 3hrs with this problem. Thank you for saving lot’s of time.

  5. Lyubomir says

    Thanks a lot for the great article !
    It resolved my issue – it happened on trying to upgrade my localhost WordPress installation from v.5.2.5 to v.5.3.2
    Adding the line “php_value max_execution_time 300” at the bottom of the .htaccess file proved to be enough, in my case.
    Best regards !

  6. Al-Amin Khan says

    I was very upset for this problem. After reading your article this problem has solved.
    Thank you so much.

  7. Amelia John says

    Hey Dears,
    I am getting a maximum execution time limit error like below when clicking on the woocommerce settings tab. I added max_execution_time = 360 to php.ini file however it’s not working as well.

    Deactivated every plugin by keeping woo-commerce only also changed to a default WordPress theme, none of these steps work for me.

    Any good hearts here to help me to sort out this issue?

    • WPBeginner Support says

      Reach out to your hosting provider to see if they have an overriding setting preventing you from changing the execution time for your site. That could be the likely reason

      Admin

    • Kaan Oezgiray says

      Try this in your script (I placed it on the first line and it works):
      ini_set(‘max_execution_time’, ‘600’);

      Hope it helps.

      -Kaan

  8. mubarak hassan says

    How can I solve this? Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\wp\wp-includes\Requests\Transport\cURL.php on line 163

  9. MU says

    down vote
    You have to just check whether your WAMP server is online or not.

    To put your WAMP server online, follow these steps.

    Go to your WAMP server notification icon (in the task bar).
    Single click on the WAMP server icon.
    Select last option from the menu, that is, Put Online
    Your server will restart automatically (in the latest versions only). Otherwise, you have to restart your server manually.
    And you are DONE…

  10. Waqas says

    Hi, I have been facing this issue for along time don’t know how to solve it.

    I am getting this error while visiting my homepage Warning: session_start(): open(/tmp/sess_e8717886215bae41c9c82993bd822901, O_RDWR) failed: Disk quota exceeded (122) in /home/waqas1385/public_html/example.com/wp-content/plugins/easy-contact/econtact.php on line 112

    I have searched my whole site but I don’t have this plugin ‘easy contact’ installed and I can’t find it in the file manager.

    please help me how to fix this error. Thanks

    • WPBeginner Support says

      Hi Waqas,

      Try using an FTP client and locate this folder manually. Make sure that your FTP client is set to show hidden files too.

      It seems that some poorly coded plugin is starting sessions and your server is unable to delete temporary session files. It could also be caused by a temporary files stored elsewhere like your web hosting mailboxes.

      Admin

  11. Jess says

    This didn’t work for me, now I can’t even get to the log in page and it gives an error message for my whole site :(

  12. Ahmad says

    Hi I am using php 5.5
    When i open .htaccess code editor in cpanel i see the following text
    where should i exactly add this code and save it?

    # Use PHP55
    AddHandler application/x-httpd-php55 .php

    suPHP_ConfigPath /opt/php55/lib

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

  13. Ellayararwhy says

    This doesn’t fix the underlying problem at all, which is that something running under WP is totally consuming CPU resources. To suggest that just increasing the timeout value is a fix is not good practice – focus on the root cause.This can happen in many ways (apache library, synchronous read, etc), but the usual culprits are some PHP code in some WP plug-in stuck in a very long or infinite iteration loop. Perhaps there is a weird interaction between two or more WP plugins.

    In all scenarios, including ones not discussed, is that you have to back off (disable) your WP plugins until the CPU load decreases to a reasonable value. The next step is to figure out how to track down a plugin problem or plugin interaction issue, which may involve quality time on forums focused on the suspect plugins.

    • Leo says

      I agree with @ELLAYARARWHY. The point of setting max execution time is for security and the users experience, changing the settings this way to me is only putting a patch on the issue rather then actually fixing it. Increasing the time is not a long term solution.

  14. ZS says

    I have WordPress 4.1 installed on XAMPP. I didn’t have any .htaccess files in the wp-content and wp-admin folders. I added them myself with the code you mentioned but that didn’t fix the error. I’ve also tried installing the plugin and that also did not fix the error.

    I tried running WordPress on WAMP and I am getting the error on WAMP too. I am getting this error when I try to import the Theme Unit Test XML file. What else can I do? :(

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.