Skip to content

Changing the PHP max_execution_time directive

The max_execution_time directive in PHP controls how long a script is allowed to run before it is terminated. By default, this value is set to 30 seconds. If your application requires more time (for example, importing large datasets or running complex processes), you can increase this limit.

  • Prevents scripts from timing out during long operations.
  • Useful for applications that process large files or perform heavy database queries.
  • Helps developers fine‑tune performance and resource usage.

Create or edit a php.ini file in your application directory:

max_execution_time = 60

This sets the maximum execution time to 60 seconds.

If your hosting environment supports .user.ini, add:

max_execution_time = 60

On Apache servers, you can override the directive:

php_value max_execution_time 60
  1. Log in to cPanel.
  2. Go to Software → Select PHP Version → Options tab.
  3. Locate max_execution_time.
  4. Set the desired value (e.g., 60, 120).
  5. Save changes.