-1

I've found that on a website I have set up on two different servers, on one of the servers, when I upload a particular file, the file's mimetype is detected as video/mpeg using mime_content_type($filepath);, but on the other server, the same file mimetype is determined to be application/octet-stream in the same line of code. Is there some sort of PHP setting or differences in PHP versions that would cause this to happen? The first server is running PHP 5.3.27, and the second is running PHP 5.3.2.

Edit: The same thing happens when I try to determine mimetype through FileInfo as well.

Kai
  • 3,803
  • 1
  • 16
  • 33

1 Answers1

0

I could not find related information but I think PHP is getting the mime info from /usr/share/mime/.

Please look in /usr/share/mime/video/ if you have mpeg.xml.

If not, here is mine (I might delete in in the near future).

Also you can try to run the command /usr/bin/update-mime-database.

Further information: https://wiki.debian.org/MimeTypesSupport

Update:

PHP uses /usr/share/file/magic.mgc magic mime database.

Please google for how to update this database and after reloading PHP it might work.

Daniel W.
  • 31,164
  • 13
  • 93
  • 151
  • Could I just replace /usr/share/file/magic.mgc on the server that doesn't work with the same file from the other? I tried to do so, then restarted apache, but it did not seem to work either. – Kai Sep 25 '14 at 22:20