Bug 163116 - mime_content_type fails because of wrong mime_magic.magicfile
Summary: mime_content_type fails because of wrong mime_magic.magicfile
Alias: None
Product: Fedora
Classification: Fedora
Component: php
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2005-07-13 00:22 UTC by Anders Kaseorg
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version: 5.0.4-10.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-09-08 10:22:26 UTC
Type: ---

Attachments (Terms of Use)

Description Anders Kaseorg 2005-07-13 00:22:10 UTC
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):

How reproducible:

Steps to Reproduce:
1. Open a .php file containing <?php phpinfo(); ?>.

Actual results:
mime_magic support: invalid magic file, disabled
mime_magic.magicfile: /usr/share/file/magic.mime

Expected results:
mime_magic support: enabled
mime_magic.magicfile: /etc/httpd/conf/magic

Comment 1 Ian Neubert 2005-07-14 18:07:48 UTC
Same problem with php-5.0.4-10.3.

Comment 2 Ian Neubert 2005-07-14 18:09:12 UTC
I guess that was the OP's version too. I should have read it a bit more carefully.

Comment 3 Joe Orton 2005-08-04 12:38:38 UTC
Thanks for the report, this will be fixed in a future update.

Comment 4 Joe Orton 2005-09-08 10:22:26 UTC
This was fixed in the 5.0.4-10.4 update - thanks for the report.

Note You need to log in before you can comment on or make changes to this bug.