
To a site owner or administrator, WordPress errors are quite discouraging and, at times, irritating. One such error is the max_execution_time error or the message: “Fatal error – Maximum execution time of 30 seconds exceeded”.
The maximum execution time is like a time limit set for your website to do certain tasks, like uploading large files or plugins. If the task takes longer than that set time, it will throw this error, essentially saying, “Oops! Time up.”
However, it is pretty simple to resolve this error by increasing the max execution time. In this blog, you will find five different methods to do so. You will also learn how to find out your current settings and how to know if the error has occurred.
- What is max_execution_time?
- What Is max_execution_time Error?
- Why You Need to Increase max_execution_time for Large File Uploads
- How to Check Your Current max_execution_time Setting
- How to Know if WordPress max_execution_time Error Has Occurred
- How to Fix Current max_execution_time Error
- Uninstall the Porblem Plugin or Theme
- Summary
What Is max_execution_time?
PHP makes sure that the scripts don’t keep running indefinitely and consume excessive server resources.
So, max_execution_time is a setting that allows scripts to run for a limited amount of time. Usually, this time is set to 30 seconds. But it depends on the server as well as PHP installation.
Experience Error-Free Hosting at 40% Off (Limited Time Offer)
No more annoying hosting and limitation errors. With Cloudways Autonomous, you can enjoy effortless scalability with Kubernetes-based autoscaling, super-fast speeds, and high uptime, ensuring your website remains fast and responsive.
What Is max_execution_time Error?
This error usually shows up when you’re uploading or updating a plugin, theme, or WordPress core.
When a script runs more than that set time in the default setting, PHP will show you an error message that looks like this:
Fatal error: Maximum execution time of X seconds exceeded in /path/to/your/script.php on line Y
It will be displayed on your WordPress admin dashboard like this:
Source: YouTube/wpguide
Reasons behind max_execution_time error in WordPress
Hackers often use endlessly running PHP scripts to slow down websites which is why most WordPress websites have this set limit. It kind of protects your website from server abuse.
There are multiple situations where the max_execution_time error may pop up.
One of the most common reasons why max_execution_time error happens in WordPress is a heavy theme or plugin installation. Any plugin or theme that is not optimized or eats up a lot of resources can be a troublemaker.
Other times, it is possible that the server’s default execution time is simply set to a number that’s too low. This usually happens when you’re using shared hosting instead of managed hosting.
Sometimes, the error can also occur if you’re uploading really large files, such as lengthy high-quality videos.
Why You Need to Increase max_execution_time for Large File Uploads
If the file you want to upload is large, then the PHP script that handles the upload process may run for more than the specified time limit of the server, as explained earlier.
This can lead to issues such as files not being fully uploaded, server errors, and one thing you cannot afford at all: poor experience for the users.
Essentially, what you are doing when you increase max execution time, is increasing the time that the script has to run, meaning that large files can be uploaded without errors.
What If You Don’t Increase max_execution_time for Large Uploads?
There are several risks if you choose to keep your execution time limited and ignore the errors. The risks include:
- Files may be corrupted or lost due to incomplete uploads.
- Timeouts and internal server errors can occur.
- User frustration and lost business opportunities.
- Malicious files can be uploaded.
How to Check Your Current max_execution_time Setting
There are several ways to check your current max_execution_time setting, but the easiest one is to use the Health Check & Troubleshooting plugin.
Here’s how:
1. Go to your WordPress dashboard.
2. On the left panel, click Plugins > Add New Plugin.
3. In the search bar on the right, type “Health Check & Troubleshooting”.
4. Click on Install.
5. Once installed, click on Activate.
6. Once the plugin is set to go, on the left panel again, look for Tools > Site Health.
7. Click on Info (next to Status) and then scroll down to Server.
8. In the server dropdown, you will find “PHP time limit”. In my case, it says “60”, which means 60 seconds.
How to Know if WordPress max_execution_time Error Has Occurred
Usually, WordPress will send site owners and WordPress admins an email informing them that a plugin or theme is causing a Fatal Error.
Other than that, while you’re uploading a plugin or theme, your dashboard will display the following message too.
Another way to find out if there is a max_execution_time error on your site is to see what’s happening on the front end. The message to users may read:
“The site is experiencing technical difficulties”
Or
“There has been a critical error on your website”
Find Out How to Fix 25+ Most Common WordPress Errors.
How to Fix max_execution_time Error and Increase the Limit
There are six methods to resolve the max_execution_time error in WordPress. The first one would be to get rid of any problematic plugins or themes on the website.
The rest would be to increase the max execution time.
- Method 1: Uninstall the Porblem Plugin or Theme
- Method 2: Using a Plugin to Increase Execution Time
- Method 3: Editing the php.ini to Increase Max Execution Time
- Method 4: Modifying the .htaccess file to Increase Max Execution Time
- Method 5: Editing the wp-config.php
- Method 6 (Easiest): Request Your Hosting Provider
Method 1: Uninstall the Problem Plugin or Theme
If the problem appeared after the plugin or theme installation, you can assume it’s the one causing the problem.
- Just go to Plugins > Installed Plugins.
Scroll to the one you recently installed. - Click on deactivate right below the name.
We have a blog about how to disable or delete plugins, if you want to learn in depth.
But if the recently downloaded plugin does not turn out to be the problem and your WordPress error remains, how do you find out what the issue is?
Consider these factors:
- Check your email for any error notifications from WordPress
- Deactivate each plugin one at a time to identify which one could be the culprit.
- Maybe downgrade the WordPress version. The latest WordPress update can sometimes be causing issues.
💡Downgrading your WordPress version should be your last choice. The latest WordPress versions are very important for your website’s performance and security.
If this doesn’t work, you simply increase the max execution time on your WordPress website. The following methods will teach you how to do that.
Method 2: Using a Plugin to Increase Execution Time
Using a plugin to increase max execution time in WordPress is a very good choice for those who aren’t comfortable with technical options like modifying server files.
For this tutorial, I have used the Increase Maximum Upload File Size | Increase Execution Time plugin. It has 70,000+ active installations and was updated yesterday (at the time of writing), which means it has been tested with WordPress 6.7, the latest version of WordPress.
To activate this plugin:
- Go to your WordPress dashboard.
- On the left panel, click on Plugins > Add New Plugin
- In the search bar, type Increase Maximum Upload File Size | Increase Execution Time.
- Click on Install.
- Click on Activate.
To increase the execution time, take these steps:
1. On the left panel, click on Media > Increase Upload Limit.
2. Enter the time of your choice in the Maximum Execution Time section on top, below “Maximum Upload Size”
💡It is recommended not to exceed 300 seconds for the maximum execution time.
Method 3: Modifying the .htaccess file to Increase Max Execution Time
To increase the max execution time via .htaccess, you will need to connect to your server through an FTP client.
- To do this, download and install an FTP client like Filezilla.
- Then connect to your server by adding your credentials.
Cloudways users can find their credentials when the click on All Servers and pick the server they want to connect:
- Click quickconnect to access your files.
Here is what it looks like after I added my credentials:
Once you’re connected, access the .htaccesss file.
❗Before you modify your .htaccess, it is very important to back up all your WordPress files.
Secure Your WordPress Site with Automated Backups
Data loss isn’t a thing with Cloudways. Customize your backup frequency, easily download backups locally, or even clone a website from existing backups.
Once backed up, take these steps:
1. Locate the .htaccess file in /public folder.
2. Right-click the .htaccess file in your FTP client (e.g., FileZilla) and select Edit.
3. If you’re using an editor on your local computer, download the file first, edit it, and then upload it back after saving.
4. Add the following line: php_value max_execution_time 300.
Typically, place this line near the top of the .htaccess file, especially before any rewrite rules.
Method 4: Editing the wp-config.php
Another easy method of increasing execution time is to configure the wp-config.php file. Just like .htaccess method mentioned above, for wp-config.php, you will have to connect with a file client like Filezilla.
1. Locate the .wp-config.php file in /public folder.
2. Open the file for editing.
3. Add the following code at the end, just before it says “stop editing”: set_time_limit(300);
Save and upload this new file on your website through FTP.
Method 5: Editing the php.ini to Increase Max Execution Time
You can fix the max execution time error and increase the time by editing php.ini too, if your server uses that file for configuration.
To do so, take these steps:
Once connected, take these steps:
- Locate the php.ini file in /public folder.
- Open the file for editing.
- Add the following line: max_execution_time = 300
You can replace “300” with any other value you have in mind.
This method is uncommon but definitely one way you can modify maximum execution.
Method 6 (Easiest): Request Your Hosting Provider to Increase Max Execution Time
If you’re unsure about making the changes yourself, you can always reach out to the support team of your web hosting provider, show them the error that you saw, and ask them what your current execution limit is.
Then, you can tell them to increase this execution time to somewhere between 60 and 300.
In cases like these, it’s important to understand the role of the type of hosting you have. With managed WordPress hosting or VPS hosting, you can manually adjust these settings because you have full control over them.
But, if you have shared hosting, resolving errors can be troublesome. Why? Because changes made to one website can affect sites others too (i.e. the sites you’re sharing your hosting with).
Cloudways offers hosting for WordPress with 24/7 expert support where you can talk to actual humans (and not bots), that is, senior engineers, to discuss your troubles and get them resolved.
These experts work as part of your team and have an average response time of 90 seconds.
Troubleshooting Errors is Easy with Cloudways Managed Hosting
Experience Error-free WordPress Hosting. Start now and see how easy it is to run your website!
Summary
It is crucial to increase max_execution_limit on your WordPress website, especially when it comes to uploading large files.
In this tutorial, you found five different methods to change the max_execution_limit to resolve the max execution error. You also learned how you can figure out what plugins or themes may be causing your website trouble and how you can get rid of them.
If you’re a Cloudways customer, remember you can always reach out to our support team where our senior engineers will respond to you within 90 seconds and make sure to increase your limit for you so you can focus on your business, while we iron things out.
Q1. How to increase max_execution_time for importing large XML files?
You can increase the max_execution_time by editing your php.ini file or using .htaccess. However, the specific method depends on your hosting environment. Consult your hosting provider for guidance.
Q2. What is the maximum value I can set for max_execution_time?
The maximum value for max_execution_time can vary depending on your server configuration. However, it’s generally recommended to set a reasonable value (=300) to avoid performance issues and security risks.
Q3. What are the common errors when Increasing max_execution_time?
- Overreliance: It can mask underlying performance issues.
- Incorrect Configuration: Syntax errors or server-specific limitations can occur.
- Performance Implications: Long-running scripts can consume excessive resources.
- Security Risks: Insecure scripts can be exploited.
Q4. What happens when max_execution_time is set too low?
If the max_execution_time is set too low, your script may time out before completing, leading to incomplete uploads, server errors, and a poor user experience.
Hafsa Tahir
Hafsa is a content marketer who has been in the organic growth space for the past three years. With her background in Psychology and UX, she enjoys reading users' minds and is keen to try the most creative product marketing angles. Her copies scream: "you're not just a paycheck to us". Loves to crack unfunny jokes, pay gym fee and not go, and write psychologically disturbing short stories for some reason.