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
php.ini file and change the
max_execution_time value with your desired time (in seconds).
max_execution_time = 120 //120 seconds = 2 minutes
Place the following line on top of the PHP script.
ini_set('max_execution_time', 120); //120 seconds = 2 minutes