ID: 26918 Comment by: phpbug at pilif dot ch 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:
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 Previous Comments: ------------------------------------------------------------------------ [2004-01-16 06:06:23] [EMAIL PROTECTED] 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