#26918 [Com]: mime_content_type() returns text/plain always if mime_magic.debug is not set
| From: | phoeniks at nm dot ru | Date: | Tue, 12 Oct 2004 07:46:03 +0000 |
| Subject: | #26918 [Com]: 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-67463@lists.php.net to get a copy of this message | ||
ID: 26918
Comment by: phoeniks at nm dot ru
Reported By: jalonso at art3mis dot com
Status: Bogus
Bug Type: *General Issues
Operating System: debian / linux
PHP Version: 5.0.0b3 (beta3)
New Comment:
w2k
php 5.0.2RC1
apache2
same thing:
until mime_magic.debug is not set to ON mime_content_type() always
returns text/plain
Previous Comments:
------------------------------------------------------------------------
[2004-09-08 16:42:35] phpbug at pilif dot ch
while the statement with ini_alter is true, this bug is nowhere near
"Bogus".
mime_content_type()
always returns text/plain, if mime_magic.debug is not set.
PHP 5.0.1, Apache 1, Gentoo Linux
Philip Hofstetter
------------------------------------------------------------------------
[2004-01-16 06:06:23] sniper@php.net
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.
------------------------------------------------------------------------
[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