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 error. 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 script, to increase the maximum execution limit from the PHP script.

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

Leave a reply

keyboard_double_arrow_up