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

Fix Fatal Error Maximum Execution Time Exceeded in WordPress

If you are operating a WordPress website, then you should know that WordPress sets a default time as to how long a PHP script can run on your website. And if you happen to have a large website, then chances are that you may come across this particular error a lot sooner than expected. And if you are not that tech savvy, chances are that you are already panicking but the good news is that the maximum execution time exceeded error is quite simple enough to resolve, as long as you follow the step by step directions posted below. Your hosting provider could have set a low value or WordPress could have set it by default but there are at least two or three ways by which you can resolve this error asap. However, before we get into the same, it is important that you do a complete backup of all the important files. You would be editing some of the core files and naturally it makes complete sense to do a complete backup before you get started. Just review the steps listed below and you should be able to update your website without coming across any error.

1. Htaccess file:
The first thing that you need to do is to access your htaccess file and edit the same at the earliest. You need to use the FTP client credentials that your web host had provided you with and access your root directory. Your htaccess file should be located along with wp-content and wp-admin files; now download your htacces file to your system and open the same with the help of a text editor and add the following code.
php_value max_execution_time 300
Essentially, you have increased the run time for php scripts on your screen; now upload the file back to your root directory with the help of FTP client and you should be fine. All that is left is for you to reload your website and see if the issue is resolved and you are able to update your website without a hassle.

2. cPanel:
A few web hosts may not provide you with the required FTP credentials in which case, you can always use their cPanel account to log in and make the required modifications. Just login to your cPanel account, and click on “go to PHP version”, now click on ‘switch to PHP options’, and this should provide you with the menu where you can increase the time for execution for PHP scripts. Now, change the default time from 30 seconds to 60 seconds; by default, it is set at 30 seconds and you are increasing the same to 60 seconds. Click on ‘apply’ to save changes and now you should reload your website and see if the fix had indeed worked. The error in question should be resolved and you should be able to update your website without any hassle. And you did not have to tinker with any code, with this method and that’s the added advantage.

3. Plugins:
There are quite a few plugins that you can use to deal with this particular error and in all fairness, which sounds simple enough for the most novices out there. All you have to do is to download the “WP maximum time exceeded” plugin and others like the same. Just head to your WP admin dashboard, and you should be able to locate the tab “plugins’, now click on ‘add new’ and search for the appropriate plugin. Now, download and install the same on to your website and remember that you would be required to activate the same. Once you have downloaded and installed the plugin, it should increase the execution time and your PHP scripts should not have any issue running on your website. What’s more, you should be able to update your website without any issue by resolving this error quite easily. And if you want to set it back to the default value, you can always delete the plugin in question and return it back to its default value; it’s that easy.

4. Deactivate plugins:
While the above mentioned methods do work, they are not a permanent solution in the sense that they are but patches. It is important that you need a permanent solution and your core files, which essentially are coded with the most stringent standards, are not the ones to blame. So, you need to take a closer look at the plugins that you are using at the moment and see if any of the same are taking too long to execute. Granted, that’s easier said than done, but one of the effective methods is to find out if a plugin is taking too long to execute a particular script is by disabling the same. So, access your root directory, via the FTP client and look under wp-content, you should be able to locate the plugins folder. Now, change the name of the folder to something else, and this should effectively disable the same. Now, reload your website and see if the error has disappeared and if it has, then your plugins are the main problem. Now, reverse the change to the original name, and change the name of the individual plugins to something else, one by one and reload your website each time, to locate the individual plugin causing the problem. Once you do locate the said plugin, you may want to deactivate it altogether and even remove it permanently. This should help provide you with a more permanent fix, rather than a temporary patch.

These are some of the ways by which you can alter and change the execution time and thereby enable your PHP scripts to run for a longer time. Remember to do a complete back up before you carry out any of the steps listed above for all obvious reasons. By enhancing the execution time, you are enabling PHP scripts to run for a longer time on your website but a better fix would be to locate the source of the problem and look for a permanent fix rather than a temporary solution.

Thank you for visiting SKT Themes a place for selecting top WordPress Themes from a list of several hundred templates. Happy Reading and Shopping.