Last Updated on April 20, 2022 by WP Knowledge Hub
If you are updating your WordPress website’s plugins or themes and it’s taking a really long time, you might end up seeing an error message. This reads something like: Fatal Error: Maximum Execution Time of 30 seconds exceeded.
WordPress uses PHP as its primary programming language. To protect hosting servers from attacks, there is a time limit for how long a script can run.
That limit changes from host to host, but most of the time, the maximum execution time is set between 30 – 60 seconds
That’s usually enough for a good PHP script to execute.
Fix the Max Execution Time Error in WordPress
Here’s what you can do:
- Uninstall problem plugins
- Update the wp-config.php file
- Change your PHP settings in your hosting panel
- Edit the .htaccess file
- Contact your host’s tech support team
1. Uninstall Problem Plugins
If you know exactly which plugin is causing the issue, you can safely deactivate it and delete it.
In some cases it’s pretty obvious. You just installed a plugin and the next minute, none of your updates are working anymore. If you try to remove that plugin, you’ll most likely see the results you’re looking for.
If you can safely deactivate all the plugins one by one to test if one of them is the culprit, you can do so. But sometimes on a production environment, that is impossible.
If the plugins aren’t the issue, it might be that the max execution time is set too low. This can be easily resolved by changing the wp-config file, the .htaccess file, or updating your hosting settings. Let’s start with the first one.
2. Increase the Maximum Execution Time in the wp-config.php
You can increase the maximum execution time in your WordPress website’s wp.config.php file. This is a main file that contains a lot of important database information.
To do this you will need to log into your hosting account’s hosting panel, or use an FTP client like FileZilla or Cyberduck.
You’ll want to edit the wp-config.php file, scroll to the bottom and insert the following code:
“X” equals the maximum execution time in seconds. For example, you can set it to “300”, and it will extend the duration to five minutes.
Save the file, and you’ve successfully changed the maximum execution time. You can also achieve the same results by changing the PHP settings in your hosting account.
3. Change the PHP settings in your hosting account
In your hosting account’s hosting panel, like cPanel or Plesk (or any other major custom one), you will have a setting called PHP Settings, typically next to a little purplish PHP icon.
You can change these settings and update the Max Execution time to 300 here as well.
If this isn’t an option, and updating the wp-config didn’t work, try editing the .htaccess file.
4. Increase the Maximum Execution Time in .htaccess
The .htaccess file is another important WordPress file that controls a lot of things behind the scenes, and it can be accessed the same way as the wp-config file, in the same directory.
Once you’ve found it, edit it, and enter this code at the bottom to change the maximum execution time:
php_value max_execution_time 300
Remember, you can change the “300” to any other amount that works best. Save your changes, and the file will apply them to your site.
If all else fails, contact support.
5. Contact Your Hosting Provider to Request an Increase in Maximum Execution Time
Don’t forget that most hosts have a dedicated tech support team that can help with small issues like this! Give them a call, explain the problem, and tell them to try increasing the Max Execution Time to 300 + in the PHP Settings.