#26918 [Opn->Bgs]: mime_content_type() returns text/plain always if mime_magic.debug is not set
| From: | sniper@php.net | Date: | Fri, 16 Jan 2004 11:06:23 +0000 |
| Subject: | #26918 [Opn->Bgs]: mime_content_type() returns text/plain always if mime_magic.debug is not set | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53417@lists.php.net to get a copy of this message | ||
ID: 26918
Updated by: sniper@php.net
Reported By: jalonso at art3mis dot com
-Status: Open
+Status: Bogus
-Bug Type: Unknown/Other Function
+Bug Type: *General Issues
Operating System: debian / linux
PHP Version: 5.0.0b3 (beta3)
New Comment:
You can't set these options in scripts. Only in php.ini.
And you can only use the magic file that comes with Apache..
From manual (http://www.php.net/manual/en/ref.mime-magic.php):
"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."
The mime_magic.debug option, when set to On, only outputs errors during
startup. So you need to set 'display_startup_errors = On' too in
php.ini if you turn it on. Just DO NOT use this option, it's meant for
DEBUGGING.
See also phpinfo() output for this extension..it will say
"mime_magic support => invalid magic file, disabled" when you're trying
to use invalid file with it.
Previous Comments:
------------------------------------------------------------------------
[2004-01-15 06:37:32] jalonso at art3mis dot com
Description:
------------
mime_content_type() will return text/plain for all files except if you
set mime_magic.debug to On on php.ini. It won't work if you try to
change it with ini_alter('mime_magic.debug').
Reproduce code:
---------------
php.ini has
mime_magic.magicfile = "/usr/share/misc/file/magic.mime"
;mime_magic.debug = On
<?php
echo mime_content_type('/bin/ping');
?>
Expected result:
----------------
application/x-executable
Actual result:
--------------
text/plain
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26918&edit=1