Red Hat Bugzilla – Bug 163116
mime_content_type fails because of wrong mime_magic.magicfile
Last modified: 2007-11-30 17:11:09 EST
Description of problem:
PHP is built with the '--with-mime-magic=/usr/share/file/magic.mime' configure
option, causing the mime_content_type() function to fail: it always returns
'text/plain'. phpinfo() reports "mime_magic support: invalid magic file,
disabled." From <http://www.php.net/manual/en/ref.mime-magic.php>:
"The extension needs a copy of the simplified magic file that is distributed
with the Apache httpd. [...] Note: This extension is not capable of handling the
fully decorated magic file that generally comes with standard Linux distro's and
is supposed to be used with recent versions of file command."
Indeed, the function works after setting mime_magic.magicfile =
"/etc/httpd/conf/magic" in php.ini.
PHP should therefore be configured '--with-mime-magic=/etc/httpd/conf/magic'.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Open a .php file containing <?php phpinfo(); ?>.
mime_magic support: invalid magic file, disabled
mime_magic support: enabled
Same problem with php-5.0.4-10.3.
I guess that was the OP's version too. I should have read it a bit more carefully.
Thanks for the report, this will be fixed in a future update.
This was fixed in the 5.0.4-10.4 update - thanks for the report.