title: PHP Inotify Non-blocking way
body: <p>I am reading a file in linux which is a log file that keeps on updating weather the file has changed and output it to the webpage. i do it using php inotify but my problem is that it is blocking.</p>
  
  <p>How can i make php inotify non-blocking so i can do other stuff while it is monitoring the text file?.</p>
  
  <pre><code>&lt;?php
  
  $fd = inotify_init();
  
  
  $watch_descriptor = inotify_add_watch($fd, '/tmp/temp.txt', IN_MODIFY);
  
  
  touch('/tmp/temp.txt');
  
  
      $events = inotify_read($fd);
  
      $contents = file_get_contents('/tmp/temp.txt');
      echo $contents;
  
  
  inotify_rm_watch($fd, $watch_descriptor);
  fclose($fd)
  
  ?&gt;
  </code></pre>
  
  <p>Or can i do this in java?..Thanks.</p>