I need to have a PHP script running indefinitely, but I can't seem to find a good way to do this. My server runs on Windows Server 2008.
Do you think I can rely on Timer Tasks? Is there a better alternative?
Thanks in advance.
I need to have a PHP script running indefinitely, but I can't seem to find a good way to do this. My server runs on Windows Server 2008.
Do you think I can rely on Timer Tasks? Is there a better alternative?
Thanks in advance.
If you need the script to run constantly, rather than being started periodically to do whatever job it does, then you need it to enter an endless loop, thus:
while (1) {
do_something();
sleep(1);
};
Do not omit the sleep()
statement, unless you don't mind the script eating your entire processor.