Increase the PHP Script Execution Time

In PHP, the maximum execution time of each script is 30 seconds by default. Many times you need to execute a large script which took a long time. In that case, you are facing the PHP timeout. For preventing the timeout, you should need to increase the execution time in PHP. You can do it through php.ini file or PHP script.

In php.ini File

Open the php.ini file and change the max_execution_time value with your desired time (in seconds).

max_execution_time = 120 //120 seconds = 2 minutes

In Script

Place the following line on top of the PHP script.

ini_set('max_execution_time'120); //120 seconds = 2 minutes

Leave a reply

CodexWorld Newsletter

Subscribe CodexWorld updates via email and get every new post delivered to your inbox.