Are you facing maximum execution time of 30 seconds exceeded error (Fatal error) or maximum execution time of 60 seconds exceeded in WordPress when updating plugin or theme or load a page?
Here are the best solutions available for your problem.
This fatal error means that it is taking to longer for a process to complete and it is timing out. There are a number of ways to fix this WordPress error.
What is Maximum Execution Time?
Maximum execution time is a time which sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.
This helps to prevent poorly written scripts from loading. The default PHP maximum execution time is 30 seconds. You can change this in php.ini file.
Why Maximum Execution Time Exceeded error occur?
When a script reaches the maximum execution time limit (means if a script takes more than the maximum execution time limit to load), it results in maximum execution time exceeding error.
Generally, it’s coming because of low execution time that is set to 30 seconds.
How to Increase Maximum Execution time
Via php.in File
You can easily edit max execution time. Open php.ini file, then locate Resource Limits. Under resource limits, you can see the max_execution time =30, replace 30 with 90 or more.
The maximum execution code in the php.ini file looks like this.
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time=30
How to find php.ini file?
Create a PHP file and add the following code.
You can easily find your php.ini file location. Just create a PHP file on your website root directory and place the following code and run it.
<?php phpinfo(); ?>
You will get your php.ini file location on-screen like this
Loaded Configuration File: /etc/php5/cli/php.ini
Via .htaccess File
You can also set maximum execution time in .htaccess file.
- First, open .htaccess file (Which is located on your website root directory).
- If it’s not there, create a .htaccess file on your own.
- Now, check your file, if it already has maximum execution time code or not.
- If not, place this code on the .
htaccess file.
php_value max_execution_time 30
- Replace 30 with 90 or more that you want.
- Finally, save the file.
From Cpanel
If you are using cpanel on your hosting, you can easily set maximum execution time.
- First, open Cpanel from your hosting account.
- Under software, click on MultiPHP INI Editor link.
- Under Configure PHP INI basic settings, select your website.
- Now, you can see the max_execution_time option.
- Then, replace 30 with 90 or more.
- Now, click on the apply button.
- After that reboot your server.
- Max execution time successfully changed.
From WHM
If you are using WHM on your hosting, you can easily set maximum execution time. This setting will apply to your php version, So all sites (Which have this php version) settings will be changed.
- First, open WHM from your hosting account.
- Under software, click on MultiPHP INI Editor link on
left side menu. - Under Configure basic settings of a PHP version, select your php version.
- Now, you can see the max_execution_time option.
- Then, replace 30 with 90 or more.
- Now, click on the apply button.
- After that reboot your server.
- Max execution time successfully changed.
General Faq
How do I increase the maximum execution time in WordPress?
You can increase the maximum execution time via php.ini file or .htaccess file on your WordPress site.
How do I fix fatal error maximum execution time exceeded in WordPress?
You need to change the maximum execution time from 30 to 90 or more to fix fatal error maximum execution time is exceeded in WordPress.
How do I change the maximum execution time in MySQL?
You can not change the maximum execution time in MySQL. Instead, change this on the php.ini file or .htaccess file on your site.
How do I change the maximum execution time?
You can change the maximum execution time via php.ini file, .htaccess file on your WordPress site, Cpanel or WHM, etc.
Where is PHP INI file in WordPress?
PHP INI file is located in different places based on your server and OS. So read this guide to find where PHP INI file located. For example, a file located
In Cpanel Software/MultiPHP INI Editor/select website
In Windows > XAMPP C:\xampp\php\php.ini
In Linux > LAMP /opt/lamp/etc/php.ini
Where is htaccess file in WordPress?
.htaccess file located in the root directory of your WordPress site. If you can not see, turn on show hidden files on server or hosting.
External Resources
- Maximum execution time manual in php.net official site.
- The configuration file (php.ini) manual in php.net.