How to get getMimeType() to recognize .audio files correctly? (3gp, 3gpp, amr)


If I understand correctly this is actually a problem outside Yii, somewhere between PHP and Linux.

On my server (centOS), CFileHelper::getMimeType() doesn’t detect mime type correctly for audio files with extension 3gp, 3gpp, and amr recorded with mobile phones.

For .3gp and .3gpp audio files, it returns a video mime type, while for amr files it returns null.

Documentation says that getMimeType uses first finfo, then mime_content_type, and then the extension as a last resort. How do finfo and mime_content_type work?? I seem to guess it somehow delegates the mime file recognition to the OS, right? Is that done solely based on the file extension anyway? (I hope not!!) Is there some package I can install so that the OS will recognize these file types correctly? It’s centOS linux.

I know that the .3gp extension is used also for video files. I need it to be able to properly distinguish 3gp audio files from 3gp video files.

Regarding amr files, it should be able to recognize them by extension if everything else fails…

Any idea?