I have a PHP script configured to loop endlessly using set_time_limit(0)
and for(;;)
. The script is coded to listen on a specific directory and wait for files. When files are detected, execute some commands and keep the loop going. So far this has been very successful for my needs, but I have concerns.
Are there any performance disadvantages to creating an infinite loop in PHP? How can I configure my server so that this script never stops running? Or perhaps alerts me when it has stopped running? I'd like it to launch on startup too. I have a SUSE SLES 10 box.
for (;;) {
// Check for empty directory
if (isEmptyDir($finishedDir)) {
// If so, move on
continue;
} else {
// do stuff.
}
}