title: Read last line from file
body: <p>I've been bumping into a problem. I have a log on a Linux box in which is written the output from several running processes. This file can get really big sometimes and I need to read the last line from that file.</p>
  
  <p>The problem is this action will be called via an AJAX request pretty often and when the file size of that log gets over 5-6MB it's rather not good for the server. So I'm thinking I have to read the last line but not to read the whole file and pass through it or load it in RAM because that would just load to death my box.</p>
  
  <p>Is there any optimization for this operation so that it run smooth and not harm the server or kill Apache?</p>
  
  <p>Other option that I have is to <code>exec('tail -n 1 /path/to/log')</code> but it doesn't sound so good.</p>
  
  <p>Later edit: <strong>I DO NOT want to put the file in RAM because it might get huge. <code>fopen()</code> is not an option.</strong></p>