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)) ?

link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

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.

link|improve this answer
so if curl_exec took more than 5 seconds, it's executed (for example in 39 seconds) and then php dies ? – genesis Jul 15 '11 at 12:46
1  
Yes, exactly... – womble Jul 15 '11 at 12:49
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.