title: Read line by line from an updating log file in real time
body: <p>I have a log file from which I am writing the data to a php file. This is the code for that:</p>
  
  <pre><code>$filename='/var/log/siawa/dashboard/iot.log';
  
  $source_file = fopen( $filename, "r" ) or die("Couldn't open $filename");
  
  while (!feof($source_file)) {
      $buffer = fgets($source_file, 4096);  // use a buffer of 4KB
      $buffer = str_replace($old,$new,$buffer);
      echo $buffer. "&lt;br /&gt;" . "\n";
  }
  </code></pre>
  
  <p>This is working but i want to update the php log data after say every 10 seconds once its gets written in the original log file. How to do that.</p>