How to Fix Fatal Error: Maximum Execution Time Exceeded in WordPress

May 22, 2016 WordPress

I’ve been doing quite a few WordPress sites for clients lately and I use a lot of premium templates from templateforest.net. These templates are great but you can run into php errors with them from time to time dependent on your server’s settings for php. Sooner or later you’re going to run into some kinds of php error and that brings your site to a screeching halt. The most recent error that I encountered was this:

1.Maximum Execution Time (max_execution_time) : 30

I ran into several solutions, or so I thought, to correct this error. Again, dependent on your server’s php settings and where you host your site, this can turn into a giant headache in a hurry. I’m going to give you two methods that work and the one method that worked for me. It saved me so much time and got my project back on track with the client.

Method 1: Editing the .htaccess file

Using your favorite FTP clinet (mine’s Filezilla), edit your .htaccess file that’s located in your site’s root folder, where all of your main WordPress files reside as well.

Right click on the file (in Filezilla) and choose View/Edit and edit the .htaccess file in your text editor of choice. I prefer Notepad++.

At the end of the .htaccess file, paste this snippet of code.

1.php_value max_execution_time 300

This code sets the value for maximum execution time to 30 seconds. Some WordPress templates may require 60 seconds or more, if so, simply change the value to 600 or more dependent on your template’s needs.

Method 2: Editing the wp-config.php file (method that worked for me)

Again, using Filezilla (FTP) to connect to your server, in the root folder of your site, edit the wp-config.php file.

Scroll to the bottom of the file and above the commented out code that reads:

1.“/* That’s all, stop editing! Happy blogging. */”

Paste this snippet of code:

1.set_time_limit(60);

I hope that one of the above methods works for you, the wp-config.php file edit method is what worked for me. Happy coding.