Note. I know that this does not directly answer the question about the version of PHP. However, I found this post trying to solve my problem, and therefore it may be useful to someone in the future.
I also recently tried to deal with the Fileinfo library, trying to check MP3 files. I realized that there are known issues with Fileinfo and MP3 files, even if you correctly configured the magic database file for your environment.
If Fileinfo cannot determine the type of MP3 mime, it can return application/octet-stream . Not very useful when checking a file.
As an alternative, I started using the following system command. This is very similar to the @marios suggestion and still seems more reliable than Fileinfo .
$path = 'path/to/your/mp3/file.mp3'; $mime = exec('file -b --mime-type ' . $path);
I tested this on Ubuntu 10.04 and OSX Mountain Lion, so I assume it works on most Unix environments. I believe that there are some Windows ports.
In truth, I'm not quite sure how safe or reliable this method is, but I saw that it recommended <a href = ""> a few times here in Stackoverflow. If anyone has more information, please share!
source share