Fixing the WordPress max_execution_time Fatal Error

wordpress-max-execution-time

Introduction 

No WordPress website is free from errors and issues. This fact makes your website more powerful and easy to tackle any mishap. 

Well, you have come across some errors that may hurt your website in any way. One of those errors is the “Fatal Error: max_execution_time exceeded." Has this error ever touched your website? If you ever got this error on your website, then you have entered the right place to tackle it. This is not a scary error; it can be easily resolved if good measures and fixes are used. This blog will let you know every bit of it, along with useful and tried solutions for this error. 

What is the WordPress max_execution_time Error? 

You must be aware of such errors occurring on your website while installing certain plugins or themes. What happens is the execution time eventually exceeds from the server side, and you get an error message. It looks like: 

“Fatal Error: Maximum Execution Time of 30 Seconds Exceeds.”. 

The message usually appears when you are installing or updating any part of your site, or the WordPress core can be the reason. The 30-second value is not the actual value; it can vary according to the website. You need to know more about it and ways to make it right. 

Why Does the WordPress max_execution_time Error Occur? 

Not every website has the same execution time limit to process the server request. For some websites, it may be 30 seconds, and for some, it reaches up to 60 seconds. This time limit is decided with the web hosting plan you have and can be manually updated.

Now the execution time limit is decided to avoid the server abuse as it can use too many resources with the increasing time. Even when you switch between hosts, this type of error can freak your way.

WordPress files are mostly run on PHP scripts; it is vital not to blink your eye on the PHP scripts, whether they are running too long. When PHP scripts take too long to run, understand that it is consuming too many resources on your site. Unfortunately, the result is most common WordPress error i.e. fatal error max execution time. 

Most of the time, plugins are the triggering elements for such types of errors. Also, themes and other WordPress elements can be another reason to have more resources occupied. 

When it comes to plugins, the installation number is comparatively higher than themes and other elements. Moreover, plugins installed in more numbers can cause this error, and it becomes hard to find which one is creating an issue. Regardless of all these issues, there can be a hosting service that sets a finite limit for the execution time.

You should be aware of the standard maximum execution time limit of your WordPress website. 

What is the Standard Maximum Execution Time Limit? 

You know your hosting service sets the maximum execution time limit. This is where you need to know that most hosting services opt for 30 to 60 seconds for the maximum execution time. 

This is enough range when PHP scripts can easily count on the resources to load the request. 

Generally, it takes almost a 30–60-second time limit for any high-quality PHO script to work. However, some developers may increase it to 60 seconds depending on the code and server response. Although the time limit can be set up to 300 seconds, giving such time isn’t a wise decision. 

As soon as you know that your website is consuming too many resources, just know that your website requires a powerful server. It is because sometimes the hosting companies set the lowest limit for the websites, and eventually issues arise. The best way to deal with it is to contact your hosting service. 

How Do I Figure Out if a WordPress max_execution_time Error has Occurred? 

Now, the thing arrives when you need to find out the error has been encountered on your website. How do I find it? The simplest way to find out the error is to check the message box in the dashboard. You know that this message often occurs while installing or updating a plugin or theme. 

There is another way to find out the error is to watch out for the frontend messages to users as “The site is experiencing technical difficulties.”. 

The message may be different sometimes, but the cause might be the same. Sometimes, it will show “There has been a critical error on the website.”. 

And lastly, WordPress sends an official message that a plugin or a theme is causing a fatal error. It comes with a resolving link to vanquish the cause by letting you know the problematic plugin or theme.

Detecting a WordPress max_time_execution error can be tricky as it often manifests in cryptic error messages. While there are technical solutions to pinpoint this issue, a proactive approach is to prevent it altogether. Opting for themes that prioritize fast loading and responsiveness can significantly reduce the risk of encountering this error. With over 240+ high-performance themes, the WP Theme bundle by VW Themes offers a robust solution to enhance your website's speed and efficiency.

Fixing the WordPress max_execution_time Error 

Finally, we have reached the stage where you will come across various solutions to fix this max_execcution_time error. 

1. Uninstalling the Problematic Item 

The first way to come out of this error is to uninstall the problematic item that is creating an issue. However, it will not maximize the execution time but resolve the error from your website. 

There is another option where you need to replace the problematic plugin or theme with a suitable one. For this, you need to identify and remove the problematic item that is causing errors on your site. 

What you need to do is uninstall the recently updated or added content on your website. Uninstall the item that was recently added, and the error occurred just after adding it or updating it to the latest WordPress version. 

You need to then check your mailbox to see whether WordPress has informed you about such an error. As it sometimes lets you know about which element is causing the issue. 

If you need to learn about the above queries, simply deactivate each plugin and refresh if the problem is solved. Once you discover the problematic plugin, remove it from your site.

2. Increasing the max_execution_time in WordPress Using a Plugin 

Here’s another method where we are going to increase the WordPress max_execution_time using a plugin. This is the method where the max_execution_time is increased to give the PHP scripts more time to work. But there is already the max_execution_time set for the security of your website and the server, so it is better not to change it.

Another way to modify the maximum execution time is to install a plugin on your dashboard. The plugin installation will make changes to the configuration files rather than the WordPress files. WordPress comes with a lot of plugins where security measures are on a higher basis when it comes to maximizing the execution time. 

One of those top-quality plugins we are choosing is the Google Pagespeed Insights plugin for this guide. Once you have installed and activated the plugin, it will appear under the dashboard area of your website. 

Reach the Tools section under the dashboard area and then tap Pagespeed Insights.Find the Advanced configuration, and now you can change the maximum execution time as per your needs. However, it is highly advised to keep the default settings as they are for your website’s stability.

Nevertheless, if you have made changes, now you need to tap the Save Changes button. 

3. Modifying the Maximum Execution Time in the wp-config.php File 

Here’s another way where you can maximize the execution time limit using the wp-config.php file. 

For this, you need to get connected using the FTP client and find the root folder. Once found, click it and then tap the “/public” folder. 

Under the public folder, you will find the core files, including the wp-config.php file. Open the wp-config.php file and place the below code into it: 

set_time_limit(300)

You can place this code line anywhere, but it will be better to place it at the last part of the code. Save changes when you are done. 

4. Increasing the WordPress max_execution_time in the “.htaccess” File 

You are bringing on another method where you can increase the maximum execution time in the “.htaccess” file. 

You know the default time is 30 seconds, but in case the PHP scripts need more time to work, you can edit it in the “.htaccess” file. 

Visit the File Manager in your host’s hPanel and then navigate to the public_html directory. 

Double-click on the “.htaccess” file to open it. Now in the “.htaccess” file, you need to add the below code: 

php_value max_execution_time 60

php_value max_execution_time 60

Open code in a new window. After this, save and close the file. 

5. Changing the Maximum Execution Time in the php.ini File

We are with another method where you will know how to maximize the execution time limit using the php.ini file.

Firstly, you must know the php.ini file sets the default configuration for any application for which PHP is used. Most importantly, you can access this file only if your host uses cPanel. 

So here we are assuming your host has access to cPanel, and so it uses a tool called MultiPHP Manager. 

Under this tool, among various options lists, you need to look for the WordPress max_execution_time and change its value by 300, and it's done. 

6. Ask Your Hosting Provider 

When running a WordPress website on a dedicated server, you get complete control to edit and shape your website. In such situations, all the above methods can be easily applied. 

But, in the case of shared hosting services, the ability to modify any core elements on the website becomes slightly impossible. 

If your website is running on a shared hosting service, you are unable to modify your site in any way. Still, if you want to maximize the execution time, there is only one way left. 

Contacting your hosting company remains the only way you can come to any result.

Conclusion 

This problematic error in WordPress max_execution_time occurs due to the slow PHP scripts. WordPress elements like free or premium plugins, free or premium WordPress themes, and other updates are often meant to be the cause of this fatal error. However, the message may be different or can’t be found easily on your website. However, it often occurs when you install or update WordPress components such as plugins, themes, and more. 

The occurrence of this error is not obvious when you have enough PHP scripts. But it hits your website when you request some resources, and eventually, PHP scripts take too much time. No need to panic at that time, as you have the above blog. We have managed to put in some of the best fixes that will help you tackle the error as soon as possible. If no fixes solve the error, you can directly tell your hosting provider to overcome this error. 

Back to blog