Bug 163116 - mime_content_type fails because of wrong mime_magic.magicfile
mime_content_type fails because of wrong mime_magic.magicfile
Product: Fedora
Classification: Fedora
Component: php (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Joe Orton
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2005-07-12 20:22 EDT by Anders Kaseorg
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 5.0.4-10.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-08 06:22:26 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Anders Kaseorg 2005-07-12 20:22:10 EDT
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 14:07:48 EDT
Same problem with php-5.0.4-10.3.
Comment 2 Ian Neubert 2005-07-14 14:09:12 EDT
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 08:38:38 EDT
Thanks for the report, this will be fixed in a future update.
Comment 4 Joe Orton 2005-09-08 06:22:26 EDT
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.