Re: set_time_limit behavior

From: Date: Mon, 12 Sep 2005 15:28:05 +0000
Subject: Re: set_time_limit behavior
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-222191@lists.php.net to get a copy of this message
Hi Jim, I certainly did overlook the ramifications of the sleep function. I modified my script so that sleep is not called: set_time_limit(1); echo ini_get('max_execution_time'), "<hr />"; echo date("H:i:s"), "<hr />"; while (true) { echo date("H:i:s"),"<hr />"; flush(); } This did time out! But, oddly it timed out only after 10 seconds. Any ideas of why the discrepancy? Thanks, Michael Jim Moseby wrote:
] set_time_limit behavior
HI Jay, Thanks for the reply. No, we are not in safe mode. That was one of the first things I looked at. It's quite a confusing issue. I certainly have had PHP time out on me before, and have juggled max_execution_time to solve this. But with it just running indefinitely regardless of INI values or run time setting... well its a little disturbing! Thanks, Michael Jay Blanchard wrote:
[snip] I am trying to figure out why a script that is set to time
     
out after 30
seconds will run indefinitely. For example, .... As you can see, this script ran for over 14 minutes. I have
     
read that
max_execution_time is bound to CPU time, and I am not sure how this translates into being able to effectively use this parameter. Comments / insight extremely appreciated. [/snip] Are you running PHP in safe mode? If so set_time_limit() has
     
no effect.
From the online manual: 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(), the sleep() function, database queries, etc. is not included when determining the maximum time that the script has been running. JM


« previous php.general (#222191) next »