How to increase maximum execution time in php

PhpIniExecution Time

Php Problem Overview


I want to increase maximum execution time in php , not by changing php.ini file.

I want to Increase it from my php file.

Is this possible?

Php Solutions


Solution 1 - Php

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('max_execution_time', '0'); // for infinite time of execution 

Place this at the top of your PHP script and let your script loose!

Taken from Increase PHP Script Execution Time Limit Using ini_set()

Solution 2 - Php

use below statement if safe_mode is off

set_time_limit(0);

Solution 3 - Php

Use the PHP function

void set_time_limit ( int $seconds )

The maximum execution time, in seconds. If set to zero, no time limit is imposed.

> This function has no effect when PHP is running in safe mode. There is > no workaround other than turning off safe mode or changing the time > limit in the php.ini.

Solution 4 - Php

You can try to http://php.net/manual/en/function.set-time-limit.php">`set_time_limit(n)`</a>;. However, if your PHP setup is running in safe mode, you can only change it from the php.ini file.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPritesh MahajanView Question on Stackoverflow
Solution 1 - PhpJames ScholesView Answer on Stackoverflow
Solution 2 - PhpAmirView Answer on Stackoverflow
Solution 3 - PhpTheEwookView Answer on Stackoverflow
Solution 4 - PhpAdam WrightView Answer on Stackoverflow