Re: Infinate looping
| From: | Andrew Kreps | Date: | Sun, 19 Sep 2004 11:06:03 +0000 |
| Subject: | Re: Infinate looping | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197170@lists.php.net to get a copy of this message | ||
On Sat, 18 Sep 2004 19:48:37 -0500, Stephen Craton
<webmaster@melchior.us> wrote:
> Here's what I'm doing in a nutshell: Loop infinitely, checking for changes
> to a database, flushing the data, sleep, and repeat the loop. It all goes
> well and I'm getting it to work correctly. However, I'm not sure on the
> impact on my webserver.
Personally, I think you're taking the wrong approach to solve your
problem. PHP scripts were meant to execute in short fashion, to get
over and done with. If you need something that checks for changes,
don't make the PHP script run from now until doomsday, set it up as a
scheduled task that runs every minute (or whatever interval you
require). It's a much cleaner setup, and you're removing the
webserver from the equation since you'll be running PHP from the
command line.