title: PHP script listening on a directory
body: <p>I have a PHP script configured to loop endlessly using <code>set_time_limit(0)</code> and <code>for(;;)</code>. 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.</p>
  
  <p>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.</p>
  
  <pre><code>for (;;) {
      // Check for empty directory
      if (isEmptyDir($finishedDir)) {         
          // If so, move on
          continue;
      } else {
         // do stuff.
      }
  }
  </code></pre>