Maximum execution time of %d second%s exceeded

Description

This error indicates that the application has been running for longer than an acceptable amount of time: by default, 30 seconds.

To avoid working indefinitely on a task, PHP cancels its execution.

It is common to set this duration to low levels, so as to keep execution time short. In a production environement, any such error should be investigated, and refactored.

Example

<?php

// an infinite loop that will break beyond max execution time, eventually
for(;;) {}

?>

Literal Examples

  • Maximum execution time of 30 seconds exceeded

Solutions

  • Write faster PHP code.

  • Write lighter PHP code.

  • Update the configuration directive max_execution_time for the whole application.

  • Update the configuration directive max_execution_time for a part of the application.