title: Where does PHP finfo() gets its file information? It doesn't match "file -i" output
body: <p>It's annoying, I can't get the correct MIME type for many different files using php finfo(). </p>
  
  <p>Here's my little test program:</p>
  
  <pre><code>&lt;? $finfo = new finfo(FILEINFO_MIME);
  echo $finfo-&gt;file('/mnt/partage/Film/Sintel.2010.1080p.mkv');
  </code></pre>
  
  <p>Its output is completely incorrect:</p>
  
  <pre><code>application/octet-stream; charset=binary
  </code></pre>
  
  <p>Here's <code>file -bi /mnt/partage/Film/Sintel.2010.1080p.mkv</code> output:</p>
  
  <pre><code>video/x-matroska; charset=binary
  </code></pre>
  
  <p>Apparently php finfo() doesn't use the proper magic file. However there aren't many options: either it's <code>/usr/share/file/magic</code> or <code>/etc/magic.mime</code>, none of them works from php.</p>
  
  <p>I'm running this on Debian stable (wheezy) with backports libmagic. The problem occurs both when calling the program from Apache or the command line.</p>