I tried this on most of the servers I have, and PHP seems to return application/ogg
for ogv video files. This is strange, because the Apache mime config file clearly lists video/ogg
(also not desirable, but at least it would make sense since the info is supposed to be coming from there). Originally I encountered this problem in Responsive File Manager, but was able to reproduce it independently.
The code:
$fileinfo = finfo_open(FILEINFO_MIME);
$mime_type = finfo_file($fileinfo, $file);
finfo_close($fileinfo);
var_dump($mime_type);
The output:
string(31) "application/ogg; charset=binary"
Where is this information coming from, and how can I change it?
Putting .htaccess directives doesn't seem to help at all. It probably also matters that I am running cPanel/WHM, but wasn't able to find any additional relevant configuration. Moreover, cPanel also gives video/ogg
for ogv, just like Apache.
The
finfo_file
is using the Linuxfile
command: https://linux.die.net/man/1/fileOutput of
finfo_file
:Output of
file -i sample.ogv
One solution is to use
apache_lookup_uri
which sounds like it may work for you since you're running on Apache: http://php.net/apache_lookup_uri