Web design, programming, graphics, and pretty much anything else I care about.

WebFM and mime types

WebFM calls the deprecated mime_content_type() function which returned the file type for MP4s as text/plain rather than video/mp4. The file /etc/httpd/conf/magic had to be modified by adding 2 lines:

4   string   ftypmp42   video/mp4
4   string   ftypisom   video/mp4

To verify that this worked:

echo "<?php echo mime_content_type('/mnt/video/PA/Walzer.hi.mp4'); ?>" | php

returned

video/mp4

(it returned text/plain before the change)

On other systems the file /usr/share/file/magic.mime has to be modified instead and the compiled file /usr/share/file/magic.mime.mgc had to be removed. To determine the location of the relevant magic file run

echo "<?php echo mime_content_type('/some/path/file.mp4'); ?>" | strace -o /tmp/jjj -f php

and grep for magic in /tmp/jjj