1

I'm using Command line of PHP with Yii Framework Command.

As I know on cli default value is 0

When I changed its value to 2 sec, it's giving 0 value that is success value as old value. I also checked value after changing

ini_set('max_execution_time', 2);

using

echo ini_get('max_execution_time');

it's giving correct value i.e. 2

I have put tracker for getting the total execution time after that code

$scriptStartTime = time();
.....
some code
.....
echo (time() - $scriptStartTime);

It gives more than 5 sec. Any Idea why it's not giving timeout error?

Ahmad Asjad
  • 825
  • 1
  • 8
  • 29
  • 4
    From PHP doc: `Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.` – SiZE Jun 07 '17 at 06:10
  • There is no sleep in the script – Ahmad Asjad Jun 07 '17 at 06:21
  • it's working. with this code: for($i=0;$i<99999999;$i++){ $this->output("Value: ".$i."\n"); } Earlier I thought that only sleep time is not counted, whereas db query was also there in my script Thanks – Ahmad Asjad Jun 07 '17 at 06:34

0 Answers0