How To Fix Maximum Execution Time Exceeded


Either a blank page during website load or a fatal error as shown in the example below:

Maximum execution time of 30 seconds exceeded


The cause of this fatal error is time limitation. Every web server allocates a certain amount of time per each HTTP execution. Typically it is 30 seconds however this number can be dynamically adjusted in the code with ini_set or set_time_limit function. The default timeout is defined in the php.ini configuration file as max_execution_time parameter.

There are few possible reasons why an application or website would trigger this fatal error:

  • PHP script manipulating a large amount of data;
  • PHP script performs time consuming routines too many times.


Before you start, please make sure that you have the ability to perform the following actions on your web server. Otherwise consider contacting your website hosting provider for assistance.

  • Modify php.ini file (PHP configuration file)
  • Restart Apache web server (to apply php.ini changes)

Read Me First

Based on our experience with web applications that cause this fatal error, increasing the execution time solves the issue for only a short period of time. Eventually the application starts to work with larger amounts of data, leading to more time consuming routines and causing the same error again.

The only permanent solution to this error is code optimizing. Ideally, any public facing web application should not run longer than 1 second.

Please note. Most shared hosting providers do not allow to modify php.ini configuration file. If so, you would need to consider to optimizing your web application instead.


Open your web server’s php.ini file and locate the parameter max_execution_time. Try doubling the number.

max_execution_time = 60

For more information about the max_execution_time property, check the official PHP documentation.

Fix WordPress PHP errors instantly with CodePinch!

Get Started
Thank You! Message Submitted Successfully!