Did you know that WordPress powers 35.8% of websites on the internet? With a growing user base and easy-to-use features,WordPress remains the favourite CMS of many. There are some WordPress errors that can be fixed by yourself, without having to wait for a developer.
In this article, we are going to discuss the maximum execution time exceeded error. We all know that WordPress is written in PHP programming language; this guide shows a simple yet right way to fix this error without much programming knowledge or experience.
Let’s get started.
When you try to access your WordPress site, there may be an instance when you will receive a message that says “Fatal Error: Maximum execution time exceeded.” Reading the words “Fatal Error” may be frightening, but worry not.
This message just simply means that the PHP code in WordPress took too long to execute than the allowed time limit. The WordPress hosting server sets a maximum time limit for code execution. When the PHP code execution reaches this maximum time limit, the message will appear and the server will stop the execution.
PHP is the main programming language used in WordPress. Since PHP scripts are used to build WordPress, it is important to completely execute each script within a set time limit. WordPress sets an execution time limit to prevent the abuse of web server resources.
The exact time limit varies depending on the hosting company, but it is typically 30 seconds. This time limit is usually more than enough to execute a PHP script. However, if the execution of the PHP script exceeds the set time limit, the execution is cut short and returns the “Fatal Error: Maximum execution time exceeded” message.
The error reads as “Fatal Error”, but it is one of the most common errors encountered in using WordPress. Even if it says it is fatal, this problem caneasily be resolved. There are a variety of methods to fix this issue, which is done by increasing the maximum execution time limit.
The .htaccess file is a server configuration file that instructs your server on how to respond to certain things on your website. This includes redirecting users, protecting the admin folder in WordPress by using passwords, and protecting some directories. You can manually edit the set time limit value if your PHP scripts need more execution time. Here is how you can do it:
Note: Using this code will edit the set maximum execution time to 60 seconds.
Clear your browser cache and check if the error still exists
The php.ini file defines the PHP server settings. On many WordPress platforms, this may not be seen inside the WordPress folder. If this is the case, simply creating a new file is possible. Here is how you can do it:
Note: You can edit this using Notepad. Using this code will edit the set maximum execution time to 60 seconds.
The wp-config file is a setup that is available on all self-hosted WordPress sites. During the installation process, this file is specifically generated to your site. It functions as a storage for your database information. Increasing the maximum time limit is also possible by editing the wp-config.php file.
Here is how you can do it:
Note: You can edit this using Notepad.Using this code will edit the set maximum execution time to 60 seconds.
You can increase the set time limit by simply setting it directly from PHP Configurations in the cPanel. Here is how you can do it:
If you don’t want to modify and edit codes, an easy way to increase the maximum time limit is by installing a plugin. Google Pagespeed Insights is one recommended plugin as it is straightforward and regular updates are made by the developer. To use a plugin, here is how you can do it:
This plugin allows you to test the speed of your website. You got a bonus tip!
The recommended maximum execution time limit for WordPress
The default value of the PHP time limit for most hosts is 30 seconds. However, there might be instances that 30 seconds is too short and the script needs more time to execute. You are free to increase the time limit using the stated methods; however, the default settings are recommended since it is proven that they will work fine on most websites.
Try increasing the time limit gradually such as from 30 to 60 seconds which is shown as an example in the stated methods.
Conclusion
There are easy and quick methods you can do to resolve the “maximum execution time exceeded” issue. Using the stated methods will usually resolve the error.
However, if the error still appears, you may contact your WordPress hosting provider for assistance.
References:
https://w3techs.com/technologies/details/cm-wordpress
https://wordpress.org/support/article/editing-wp-config-php/