One of the most common errors you may experience when you’re on a shared hosting plan is the ‘Fatal error: Maximum execution time of 30 seconds exceeded’ message. We know this because we’ve come across this error ourselves.
Over time, we’ve switched to better WordPress hosting providers like SiteGround to avoid such issues and improve overall site performance. However, maybe you don’t want to switch hosts right away and want to try fixing this error on your current hosting plan first.
This error typically occurs when a PHP script in WordPress takes longer to run than the time limit set by your hosting server. While this limit helps prevent server resource abuse, it can sometimes interfere with legitimate WordPress operations.
In this article, we will show you several methods to fix the ‘Fatal error: Maximum execution time exceeded’ in WordPress, whether you’re tech-savvy or a complete beginner.
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.
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.
To fix the maximum execution time exceeded error in WordPress, you can try any of the solutions below:
- Method 1: Use WordPress Recovery Mode
- Method 2: Edit Your .htaccess File
- Method 3: Modify the php.ini File
- Method 4: Edit Your wp-config.php File
- Method 5: Optimize Your WordPress Database
- Method 6: Check Your WordPress Plugins
- Method 7: Upgrade Your Hosting Plan
- Method 8: Get WordPress Support
- Learn More Ways to Solve Common WordPress Errors
Feel free to use the quick links above to skip to any method.
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.
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.
The email will also include a special link.
This will allow you to log in to WordPress using ‘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.
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.
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.
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.
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.
Method 7: Upgrade Your Hosting Plan
If you’ve tried all the previous methods and are still encountering the “Maximum execution time exceeded” error, it might be time to consider upgrading your hosting plan. This is often the most effective long-term solution, especially if you’re currently on a shared hosting plan.
Shared hosting plans, while budget-friendly, often come with limited resources. As your WordPress site grows and becomes more complex, it may require more server resources than your current plan provides.
Companies like SiteGround (which is what we use at WPBeginner), Bluehost, and Hostinger offer WordPress-optimized plans that are configured to handle common WordPress issues out of the box.
This way, you not only solve the execution time error but also gain access to features and optimizations specifically designed for WordPress sites.
You can read our guide on how to choose the best WordPress hosting and when to use managed WordPress hosting for more information.
Method 8: Get WordPress Support
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.
Or, you can also join a community like WPBeginner Engage, where you can share your problem with fellow WordPress users.
For more information about getting help for your WordPress site, read our guide on how to ask for WordPress support the right way.
Want to get help from an actual WordPress expert? WPBeginner Pro Services offers emergency WordPress support if you have no time to figure out and fix the issue. Our team can find out the root of the problem and solve it for you.
You can also get ongoing support from our WordPress maintenance experts, where we’ll take care of tasks like updating your WordPress, ensuring your website’s uptime, backing up your website regularly, and more.
Feel free to book an appointment with our team to see how we can help you and your website today.
Learn More Ways to Solve Common WordPress Errors
Experiencing other types of WordPress errors? These guides may be able to help you out:
- How to Fix the WordPress Failed to Open Stream Error
- How to Fix WordPress Posts Returning 404 Error (Step by Step)
- How to Fix WordPress Login Page Refreshing and Redirecting Issue
- How to Fix the “Sorry, You Are Not Allowed to Access This Page” Error in WordPress
- How to Fix WordPress Updating Failed / Publishing Failed Error
- How to Fix the WordPress White Screen of Death (Step by Step)
- Fix: WordPress Memory Exhausted Error – Increase PHP Memory
- How to Fix “PHP Missing MySQL Extension” Error in WordPress
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.
Mrteesurez
I am happy to discovered way to fix this error “Fix Fatal Error: Maximum Execution Time Exceeded” I have noticed that the error usually comes out when a site takes too long to open or load a page. So I presumed it’s browsers fault not know it’s from host.
Please what is the implication of keeping the duration higher than 5 minutes, what possible happened ?
WPBeginner Comments
A problem that may occur if the execution time is too long is that the site will take to long to load or process, or that the site may be overloaded.
So it’s about striking a good balance between the server capacity, load time, and site needs.
Mrteesurez
Thanks for your answer.
You’re absolutely right—finding that balance is key. I’ve encountered situations where long execution times caused site slowdowns and even timeouts, especially during high traffic performance to ensure it can handle the load efficiently without compromising on user experience. I appreciate your support.
Jiří Vaněk
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
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
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.
afnan
Thanks! it solved my issue.
WPBeginner Support
Glad our article could help!
Admin
Ricky
thank you so much bro!
WPBeginner Support
You’re welcome!
Admin
Assadullah Shaikh
That really helped, thanks mate!
WPBeginner Support
Glad our guide was helpful!
Admin
faisalnawaz
You are great, issue resolved. keep it up. once again Thank you.
WPBeginner Support
Glad our guide was helpful
Admin
mudasir abbas turi
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
Glad our guides have been helpful
Admin
nikos3194
Thanks so much for the help!
WPBeginner Support
You’re welcome
Admin
pradip
Thanks for this great article. My problem is solved
WPBeginner Support
Glad our guide was able to help you
Admin
Ranjeet Gaur
How to solve this issue on local hosted Wordpress on XAMPP
WPBeginner Support
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
Muhammad Hassan Kareem
Great,it’s work for me
WPBeginner Support
Glad our guide was helpful
Admin
Tanbir
not solving by this instruction..what i do now
WPBeginner Support
Reach out to your hosting provider and they should be able to assist
Admin
Umesh Vinayak Shejole
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.
WPBeginner Support
Glad our guide was helpful
Admin
MITESH
have just paste a code in bottom and its all done
WPBeginner Support
Glad our recommendation was helpful
Admin
Lyubomir
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 !
WPBeginner Support
You’re welcome, glad our guide was able to help
Admin
Al-Amin Khan
I was very upset for this problem. After reading your article this problem has solved.
Thank you so much.
WPBeginner Support
Glad our guide could help
Admin
Shubham Vats
Thank You so much brother
WPBeginner Support
You’re welcome, glad our guide could help
Admin
Quy
Hi there,
thanks for posting this very useful info.
It helps me a lot.
Wishing you all the best,
Quy
WPBeginner Support
Glad our guide could be helpful
Admin
Karina
I followed the steps but It didn’t work, shows 500 internal error message and site went down.
WPBeginner Support
For fixing the 500 error, you would want to go through the steps in our article here: https://www.wpbeginner.com/wp-tutorials/how-to-fix-the-internal-server-error-in-wordpress/
Admin
Amelia John
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
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
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
mubarak hassan
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
WPBeginner Support
Hey Mubarak,
Please follow the instructions in the article above. Let us know if they don’t work out for you.
Admin
Aman Gupta
My WordPress site loads after showing an error for 2 seconds ..
Jeppe Bech
Neither of the solutions worked for me.
Prof C M Sharma
Thanks for the simple yet working solution!
Shahrukh
The plugin works very well for me. Thanks a lot
mohammad
Thank you. Problem solved..
MU
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…
sina
Tanks . There problem solved
Waqas
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
Waqas
I am placing this comment to subscribe to my previous comment.
WPBeginner Support
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
Jess
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
Ahmad
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
WPBeginner Support
At the bottom of the file.
Admin
Ahmad
It doesn’t work shows 500 internal error message and site went down.
srinivas
php_value max_execution_time 300
php_value max_input_time 300
syed shahid
Thank you Sir
Helpful article I solve my problem
Tehseen
I am getting this error on local host. will this method solve my problem?
Zied
yes, this will fix it
Ellayararwhy
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
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.
Andrea Moor
Thank you for the help!
SHABBIR
Thanks for this great article.
Mohsin
Thanks for great article
WPBeginner Staff
you can try max upload filesize in php.ini file located in your WAMP directory. Alternately you can try Splitting up XML file you are trying to import.
ZS
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?
WPBeginner Staff
Yes, it would work on local installs as well.
Keith Davis
Hi Syed
I’ve had that error message a few times when updating WordPress local sites using XAMPP.
Would this solution work on a local install.
Atwine
Superb it works just fine, on a local install as well