1

I have few very-long-executing scripts, and my max_execution_time is 5

However, when I was taking some information from plus.google.com, it took about five minutes. It all worked well but it was just time-eating proccess, after those five minutes, it died on max_execution_time limit.

My question is -> how is that possible? Is max_execution_time counted only when NOTHING happends (or for example a lot of things a lot of times (infinite loop)) ?

genesis
  • 343
  • 4
  • 15

2 Answers2

3

It starts to count when you start execution; the reason why the script doesn't die until the call to google returns is that the timer isn't checked while a syscall is in progress, but when the syscall returns, PHP looks at the timer and goes "oh, you're out of time" and terminates the script.

womble
  • 96,255
  • 29
  • 175
  • 230
2

The counter is only checked when the thread of execution is within PHP - when the process is sleeping (waiting for blocking I/O) it can't check the clock. This also occurs if the thread of execution goes into an extension and stays there for some time.

symcbean
  • 21,009
  • 1
  • 31
  • 52