title: PHP fread() chunk length not taken into acount correctly
body: <p>I want to send an external MP4 file in chunks of 1 MB each to a user. With each chunk I update a database entry to keep track of the download progress. I use fread() to read the file in chunks. Here is the stripped down code:</p>
  
  <pre><code>$filehandle = fopen($file, 'r');
  
  while(!feof($filehandle)){
    $buffer = fread($filehandle, 1024*1024);
  
    //do some database stuff
  
    echo $buffer;
    ob_flush();
    flush(); 
  }
  </code></pre>
  
  <p>However, when I check the chunk size at some iteration inside the while loop, with</p>
  
  <pre><code>$chunk_length = strlen($buffer);
  die("$chunk_length");
  </code></pre>
  
  <p>I do never get the desired chunk size. It fluctates somewhere around 7000 - 8000 bytes. Nowhere near 1024*1024 bytes.
  When I decrease the chunk size to a smaller number, for example 1024 bytes, it works as expected.</p>