Got a ‘Fatal Error: Maximum execution time exceeded’ error when you attempted to install or update a plugin or theme in WordPress? Although it says so in the name, there’s nothing fatal about it. It is pretty common and will make perfect sense when we explain how it was triggered. And, even if you can’t fix the source of the problem, you can remove it and find an alternative. So, relax – your website will be back online in a jiffy. With that said, here’s how to fix Fatal Error: Maximum execution time exceeded in WordPress.
What causes it and what happens afterward?
The time limit is set by WordPress to stop its users from running a script for too long. In some cases, the script can hang indefinitely due to a syntax error. This would waste precious resources and potentially cause a website/server crash.
The time limit is between 30 seconds and 60 seconds by default, which is enough time for any of the default WordPress scripts to run. The problem arises when you install a third-party plugin or theme or add a script you found on the Internet.
If it was a plugin or a theme that caused the issue, its functionality will break. Additionally, your website will most likely display a white screen of death error (In WordPress 5.2 and earlier) or “The site is experiencing technical difficulties” error if your WordPress uses version 5.2 and later. This leads us to our first fix.
1. Disable and delete the latest theme or plugin you installed/updated
Since the error happened not too long ago, you know whether it was a theme or a plugin that caused it. If you don’t remember the exact name of the plugin, you can at least narrow down the list to two or three recent plugins. We already wrote a neat guide on how to delete WordPress themes. Instead, we’ll focus on deleting a plugin or plugins. And because it’s very likely that you are locked out of WordPress Admin Section, you can’t rely on it.
Accessing your web site’s root folder via FTP
You have two options. Both will achieve the same thing, and it’s up to personal preference.
- Download an FTP client of your choice. After you install and run the software, you’ll see the Login window. The details (your hostname, password, port number, and protocol) will be in the e-mail you received when you purchased the hosting. Feel free to contact their Customer Service if you can’t find it.
- Sign in to the cPanel on your hosting website. This requires no installation. Plus, you don’t need to look through the e-mails, since we assume you enter the cPanel every once in a while. Once there, look for a category such as Advanced, Data, Files, or Storage, and a folder inside named File Manager, or FTP.
Regardless of the option you chose, the steps are identical.
- Look for a folder titled public_html, www, root, or yoursitename.
- Inside of it, look for a folder named wp-content, then plugins.
- Inside of plugins, find the folder that has the same name as the plugin you recently updated or installed.
- Optional. Download the folder to your computer for backup purposes.
- Rename the folder to something random or delete it altogether.
For example, change its name from pluginname to pluginname-inactive. - Go back to your website and check whether it’s working now.
- Don’t try to install the plugin or theme again until you do the next step.
2. Increase maximum execution time in WordPress
There are four methods to do the same thing. Here they are:
Method 1. Install a dedicated WordPress plugin
This is the best method for people that don’t like to tweak any configurations files or play around with the root folder.
- Log in to your Admin Section.
- Here’s how to install a WordPress plugin via your Dashboard.
- In the search bar, type ‘maximum execution time exceeded’.
- Here’s an example plugin that can come up.
Feel free to use a different one. Make sure it is tested with your WordPress version. - Depending on the plugin, the default time might be set to 5 minutes (300 seconds) or you can enter the time in the plugin settings.
Method 2. Edit the .htaccess file
- Use the steps above to access the root folder of your website with the help of an FTP client or cPanel.
- Find a document file titled .htaccess.
- Right-click on it, then choose View/Edit.
- Copy the following line:
php_value max_execution_time 300 - Add it before (above) # END WordPress.
- Save the file.
Method 3. Edit the wp-config.php file
- Get to the base (root) folder of your WordPress website via FTP.
- Locate the document titled wp-config.php and open it.
- Add the following line anywhere between the first and last line:
set_time_limit(300); - Save the document.
Method 4. Create a php.ini file by yourself
Chances are, if you never altered PHP settings, this file won’t exist at all. If it does, you can skip steps #2 through #4.
- Go back to the root folder of your website using FTP.
- In the same folder where .htaccess and wp-config are located, right-click on an empty space.
- From the menu, choose to Create new file.
- Name it php.ini.
Make sure this is its full name and that FTP client/cPanel doesn’t give it an extension, such as .txt or .php. - Paste the following line anywhere:
max_execution_time = 300 - Save the file.
The location of the php.ini file can vary based on the host/stack you are using. So, find the location of the correct php.ini file that is being used in order to make this work. Some hosts may not support overwriting the existing php.ini rules.
3. Reinstall the plugin or theme or find an alternative
You overcame the main obstacle, congratulations! Now, you have two options.
- Go back to what you were doing before the error. If you get it again, go back to methods #1 through #4, and change numbers from 300 (5 minutes) to 600 (10 minutes), then try again.
- Worked? Great, problem solved.
- Didn’t work? Uninstall the theme or plugin. Contact the developer, explain the problem, and they’ll most likely fix it in the new update.
- If you need that functionality urgently, look for an alternative in WordPress’s massive database. If the situation is truly dire, look for help on stackoverflow.com or hire a professional to add that functionality or code a plugin for you.