How To Fix Max_Execution_Time Error In Wordpress


The max_execution_time directive defines the maximum execution time for your PHP scripts và applications. If not configured, the mặc định maximum execution time for a PHP script is 30 seconds. PHP will timeout và exit with a fatal error once it reaches the time limit.

Bạn đang xem: How to fix max_execution_time error in wordpress


Fatal error: Maximum execution time of 30 seconds exceeded in yourscript.phpYou can set PHP's time limit by configuring max_execution_time option so that your script won't timeout and exit with an error.

There are a few methods to lớn set the option, such as configuring the php.ini file, using ini_set() and set_time_limit() functions, and using a .htaccess file. cPanel, on the other hand, allows setting up the max_execution_time option from the web interface.

This approach will affect all the PHP scripts running in your system. It's the best solution if you're running a content management system or framework lượt thích WordPress or Drupal as you don't need to lớn configure the option manually to all the affected scripts.

Set the max_execution_time in your PHP configuration file to the number of seconds that want lớn allow your PHP scripts to execute.

Xem thêm: Cdn Là Gì? Giải Thích Tường Tận Về Content Delivery Network Là Gì ?

Look for max_execution_time directive.

; Maximum execution time of each script, in seconds;; Note: This directive is hardcoded khổng lồ 0 for the CLI SAPImax_execution_time = 30

It's not recommended lớn set the value to 0 at this level as this method's system-wide change will cause any misbehaved PHP scripts lớn unnecessarily consume precious CPU time.

It is basically the same as the previous solution, but it's actually a function you điện thoại tư vấn from your PHP script. It's a general function to override any configuration options mix in your PHP's configuration file and only affect the execution of the scripts that điện thoại tư vấn the function.

When placed at the start of your PHP script, the following function điện thoại tư vấn will allow it to lớn run for 300 seconds (5 minutes).

ini_set("max_execution_time", 300);The function hotline should be placed in shared files such as the configuration files for CMS & frameworks. For WordPress it's wp-settings.php.


It is a PHP built-in function specifically to lớn set the maximum execution time limit of your PHP scripts. It's to lớn be called from your PHP script as in the previous method, & the following example is khổng lồ also mix the limit khổng lồ 300 seconds (5 minutes).

set_time_limit ( 300 );
This is the best option if you don't have administrator access lớn your system but still want to lớn set the option khổng lồ all your scripts in your project folder.

Add the following lines to lớn .htaccess tệp tin within your PHP project folder, và this will be applied lớn all the scripts within that folder.

php_value max_execution_time 300



Author: Mohd Shakir Zakaria Cloud architect by profession but always consider himself as a developer, entrepreneur & an opensource enthusiast.

hotlive |