WordPress is mainly running based on PHP scripts. Every server sets a time limit for scripts that can run on the server. By default, the maximum execution time of PHP for WordPress is set as 30 seconds, if the limit exceeded then the WordPress shows the error as exceeded the limit. There are many methods to increase max_execution_time in WordPress.
We are dealing with many WordPress errors daily and have a strong experience to fix them. All these issues are covered under all our Server Management plans.
It can be solved by three ways;
- Edit php.ini file
- Edit wp-config.php file
- Edit .htaccess file
Let’s see how these 4 methods we can do in an apache web server.
- Edit php.ini file
We can increase the “max_execution_time” value in php.ini file and the php.ini file will be mostly located in /etc/php.ini
vim /etc/php.ini
###
max_execution_time = 300
###
- 2.Edit wp-config.php file
The wp-config.php file is the default WordPress configuration file and we can increase the “maximum execution time” in wp-config.php file
set_time_limit(300);
- Edit .htaccess file
If we use the Apache webserver then there is a .htaccess file that is used for how apache serves files from its root directory. Edit .htaccess file located in the WordPress installed root directory of apache by adding the below line at the end of the file.
php_value max_execution_time 300
After all the above changes, it is recommended to restart Apacge webserver for the changes to take effective.
service apache2 restart