Php max_execution_time

Code examples

3
0

php time a script

//place this before any script you want to calculate time
$time_start = microtime(true); 

//sample script
for($i=0; $i<1000; $i++){
 //do anything
}

$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
echo '<b>Total Execution Time:</b> '.($execution_time*1000).'Milliseconds';
1
0

php max_execution_time

ini_set ( 'max_execution_time', -1); //unlimit
0
0

how to increase maximum execution time of php script

By default, the maximum execution time for PHP scripts is set to 30 seconds. If a script takes more than 30 seconds, PHP stops the script and returns an error.
You can change the script run time by changing the max_execution_time directive in the php.ini file.
When a script is called, set_time_limit function restarts the timeout counter from zero. It means, if default timer is set to 30 sec, 
and 20 sec is specified in function set_time_limit(), then script will run for 45 seconds. If 0sec is specified in this function, script takes unlimited time.

Set Max_Execution_Time globally in php. ini
1. Locate and open your PHP build folder.
2. Find the php.ini file and open it.
3. Find the following line in the text configuration file – max_execution_time=30.
4. Change the value 30 to the value of choice, Remember, this value is in seconds.
5. Save & Close.
  
/*
I hope it will help you.
Namaste
Stay Home Stay Safe
*/
0
0

max_execution_time php

ini_set ( 'max_execution_time', 1200); //1200 is time in secondss
0
0

php max_execution_time

ini_set ( 'max_execution_time', -1); //unlimit

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................