How do you feel if you get an error while updating your WordPress theme or any of the plugins? Isn't that devastating when everything seems to fall apart?
Well, most of the WordPress users fret when they encounter with a maximum execution time exceeded error, they don't even try to find out its reasons and solutions.
Every time I hear a complaint from someone, I always try to dig if the person has put some efforts or not. For non-techie people, it's a nightmare to get such an error.
In this article, you're going to learn the reasons and possible solution to fix "maximum execution time exceed" error.
Let me start explaining. WordPress is a PHP-based platform and to protect the web server abuse, web hosting companies set the limitations for PHP scripts to execute.
If a WordPress theme takes more time then the set limit, an error occurs.
Depending on your web hosting, the PHP execution time may vary. As you know, some people prefer managed hosting over shared hosting, it's because managed hosting has more resources.
To fix this error, you require to increase the execution time limit.
Use the .htaccess File to Fix Maximum Execution Time Exceeded Error
Once in a while, you come across the usage of the .htaccess file, because it's one of the most prominent files in your WordPress directory.
If you're wondering about avoiding code editing, you can also use a plugin to increase the execution time limit. Try WP Maximum Execution Time Exceeded.
But if you can fix an issue by adding a small code to one of the files, you don't need an extra plugin.
As people say, more plugins lead to a slower website, and I am sure, you don't want that. So focus on editing the .htaccess file.
Follow these steps.
Login to the web hosting account and open cPanel, search for the File Manager icon under Files. It's one of the most used sections.
All the data of your website is available in the file manager.
You need to make sure, you open the public_html/root directory, where your website's data is present.
If you're fixing an issue for an addon domain or a sub-domain, you may need to find the correct folder. But if you have only one website on your server, you can see all the files and folders including the .htaccess file.
Right-click to edit, or you can use the Edit option showing on the horizontal navigation menu.
The server needs a confirmation to edit the file by showing a popup. Click Edit and a new tab appear to you, it consists of the rewrite rules for your WordPress website including many others.
Add the code before #End WordPress.
php_value max_execution_time 300
This code increases the PHP execution time to 300 seconds. Click Save Changes from the top-left corner and try checking your website.
If everything works, congrats, you have successfully fixed the maximum execution time exceeded error, but if you still get it, you can replace 300 with 600.
Sometimes, a plugin update or any other PHP script requires more time than expected. If nothing works, you should contact your web hosting customer support, sometimes, the company doesn't allow its users to modify the default settings.
I remember when I was trying to increase the default file upload time for WordPress, the code was denied. Make sure, it doesn't happen to you.
Isn't that a Piece of Cake to Fix an Error
WordPress may seem tricky, but once you get along, you can easily find a solution to almost every error. I understand, it's hard for non-techie people to deal with codes, but at least they can copy and paste.
I used to be like everyone else, with a fear of codes, even if you don't like to deal with them, you should understand the need of knowing about the .htaccess file.
You can fix most of the common WordPress errors using .htaccess. In the last couple of years, the web hosting companies have made it convenient to access it through cPanel.
I hope you have understood the need to increase the PHP execution time limit, if you feel that 300 seconds aren't enough, you can replace the value to 600.
But if you think practically, no PHP script takes 5 minutes to execute. Make sure your website isn't compromised. best of luck.