One of the errors you may come across while using WordPress is the fatal error: maximum execution time exceeded. The error message reads Fatal Error: Maximum execution time of 30 seconds exceeded. You may experience this error during a plugin or theme update.
Errors like this can throw you off balance, delay your work, or just plain confuse you as you wonder how to go about solving it. Fortunately, this is a common error that doesn’t occur often, but if you ever come across it, there are ways you can quickly sort it out.
The reason for this problem is when the PHP script running on your WordPress site is taking too long to run and is unable to reach the maximum execution time limit set for processing requests by your hosting server. The time limit goes through all your site’s running PHP scripts blocking those that have gone past their time limit. This helps minimize the abuse of server resources.
In this article, I will guide you on how to fix a fatal error: maximum execution time exceeded in WordPress.
Reason for Fatal Error: Maximum Execution Time Exceeded
All WordPress sites are coded to run on the PHP programming language. So to keep an eye on the PHP codes to ensure they aren’t running too long and taking up a lot of space on the server, every site comes with a set execution time limit. This way also protects your site from malicious attacks taking advantage of neverending PHP scripts.
Reasons for the error message may be your plugins, themes, or some other elements. They can take up the majority of the server resources resulting in a slow server or a server with a long loading time.
Your site’s hosting company sets the actual time limit, this means that various hosting companies have their time limits for sites on their server. However, the set maximum execution time usually falls between 30 – 60 seconds.
Once the site’s PHP script loads past its maximum execution time limit, it will show you the “Fatal error: Maximum execution time exceeded” message.
How to Fix Fatal Error: Maximum Execution Time Exceeded
One of the reasons for you getting the maximum execution time error on your WordPress site is due to a plugin or theme update taking too long to run a PHP script.
Depending on what triggered the error message, if a plugin caused it, you will receive an email telling you which plugin had triggered the error. The email will come with a link that you can use in logging into your WordPress site in Recovery mode.
Once logged in, identify and deactivate or delete the plugin or theme that caused the fatal error. You can also do this through your FTP client.
But if you choose not to remove the plugin, you will have to fix the underlying cause of the error.
To do this, you will have to personally edit your .htaccess file using your FTP client and add a simple line of code to take care of the issue.
If you are using FileZilla as your FTP client, you will find the .htaccess file in the Remote Site section which is on the right-hand column of the screen.
Once you find the .htaccess file, right-click and select the View/ Edit option to open the file with your text editor.
In the text editor, scroll to the bottom of the .htaccess file and add this line there:
1 | php_value
max_execution_time 300
When you are done, save the file.
This code increases your site’s maximum execution time to 300 seconds (5 minutes). After saving the file, go to your WordPress site to check if everything is working. If you don’t receive an error message when uploading a theme or plugin, that means you have successfully corrected the issue.
Another way you can fix fatal error: maximum execution time exceeded is using your php.ini file.
Using the php.ini file, you can perform configurations to your site’s PHP setting. This file is not popular among web hosts so there are chances it may not be inside your WordPress folder.
Add the php.ini file to your WordPress root folder. Then edit and add the line to the php.ini file:
1 | max_execution_time = 60
After adding the line of code to the file, save and upload it back to your site server. Now visit your site to ensure the error is gone.
If after doing all of these methods, the error message hasn’t gone away then you should contact your WordPress host for assistance.