The max_execution_time PHP directive determines the amount of time the server will wait before it interrupts a running PHP script. Here are a few things to consider about this directive:
- This period will start counting whenever the PHP file is executed. The time needed for preparations, file uploads, and server-side processing is not considered.
- This period includes the ENTIRETY of the script's runtime. This runtime incorporates database queries, and any loops the script may go into while executing.
- People often believe that the max_execution_time is closely tied to the php_memory_limit. While a PHP execution does require a certain amount of memory, these two directives do not have much in common. A PHP script can run for hours without reaching the memory_limit value. If this happens, it is most likely due to a loop within the code of the PHP script where the set variables are not unset, and the memory it utilizes is not released.
The default value for the PHP max_execution_time is set to 300 seconds. Of course, you may increase this based on your needs, using this tutorial.
We do not recommend overextending this directive to a higher amount, as if the PHP script you are executing is not coded correctly, you may end up utilizing all of the available resources on your hosting account. Reviewing your codes and optimizing it will be the most optimal thing you can do in this situation.