The “Maximum Execution Time Exceeded” error occurs because the various requests you send to your server take too long to complete.
By default, your server is configured to run short tasks so that its resources aren’t overloaded. In this tutorial, we will change its settings to allow longer requests.
But that’s not all. Explore the maintenance solutions in the order below, checking after each one whether the problem is solved.
Solution 1: edit wp-config.php
The solutions we’ll use here are similar to those used to fix the “Allowed memory size exhausted“.
You can raise the execution time limits by editing the wp-config.php file as follows:
- Connect via SFTP to your server using an FTP client (FileZilla is free)
- Locate your site’s folder, usually “www” (the one that contains the “wp-admin” folder)
- Right-click and edit the wp-config.php file, then add the following line:
set_time_limit(300);- Go to your site and repeat the action that triggered the error. If it is still there, try the next solution.
Solution 2: edit .htaccess
The .htaccess is another file that lets you edit your WordPress configuration, located at the same level as your wp-config.php. Go back to your FTP software:
- Locate the “.htaccess” file and edit it
- Add the line below:
php_value max_execution_time 300- Repeat the action that triggers the error once more; if it is still there, move on to the next solution.
Solution 3: create a .user.ini file
On shared hosting, the php.ini file at the root is not always read. Use a .user.ini file instead: create it with your text editor and place it in the folder that contains your site. With o2switch, the simplest way is still to change the value in cPanel, under “Select PHP version”, “Options” tab.
- Edit the file once it’s on your server
- Add the following line to it:
max_execution_time = 300- Honestly, I struggle to imagine a world where this solution wouldn’t be enough. If the error persists, read on.
Alternative solution: use a WordPress plugin
You could also have used a WordPress plugin to edit all the files mentioned above.
In the end, it comes to the same thing. Except that the plugin will needlessly weigh down your site for a line of code you could have added in a few minutes.
Yes, it won’t slow your site down by 3 seconds, but it’s the accumulation of this kind of useless plugin that makes a site slow.
As for plugins, there is, among others, WP Tools which is quite versatile and free.
Not quite your error? Have a look at my guides on the 413 Request Entity Too Large error and the 503 error.
Aren’t these solutions enough?
If nothing has worked, you can raise the value slightly from 300 to 400. Increase it gradually until everything is back to normal.
If the error isn’t fixed, you’ll have to move up a level and contact Jennifer who will work on your site.
Yes, some people recommend contacting your host, but they won’t do the cleanup that will keep you from getting this kind of error again:
- Reducing the number of plugins with overlapping features, which are resource-hungry
- Improving your site’s performance with various technical operations
- Fixing the poor coding of some scripts
- Making fixes outside of updates so that you can use your site easily