#38235 [Fbk->Opn]: mime_content_type does not return content type

From: Date: Thu, 27 Jul 2006 16:03:02 +0000
Subject: #38235 [Fbk->Opn]: mime_content_type does not return content type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100011@lists.php.net to get a copy of this message
ID: 38235 User updated by: tony at marston-home dot demon dot co dot uk Reported By: tony at marston-home dot demon dot co dot uk -Status: Feedback +Status: Open Bug Type: Unknown/Other Function Operating System: Windows XP PHP Version: 5CVS-2006-07-27 (CVS) New Comment: It is the one included in the zip file which I downloaded from the PHP website. Previous Comments: ------------------------------------------------------------------------ [2006-07-27 12:40:09] iliaa@php.net it sounds to me like you mime magic file is invalid and subsequently results in an empty mime database in PHP. This would explain why the function always returns false. Where did you get the mime magic file that you are using? ------------------------------------------------------------------------ [2006-07-27 10:52:37] tony at marston-home dot demon dot co dot uk Description: ------------ When I use mime_content_type("picture.jpg") it always returns FALSE instead of "image/jpeg". At runtime I see the error "mime_content_type(): mime_magic not initialized". I have the following in my php.ini file: [mime_magic] mime_magic.magicfile = "F:/PHP5/extras/magic.mime" mime_magic.debug = On This information shows up correctly with phpinfo(). I also notice in the phperror.log a lot of messages along the lines of: [27-Jul-2006 11:37:13] PHP Warning: PHP Startup: : (F:/PHP5/extras/magic.mime:274) 'L application/x-bootable' is not a valid mimetype, entry skipped in Unknown on line 0 Reproduce code: --------------- $content_type = mime_content_type("picture.jpg"); if (empty($content_type)) { echo "content_type is empty"; } Expected result: ---------------- I expect it to return "image/jpeg" for this file. Actual result: -------------- It always returns FALSE. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38235&edit=1

« previous php.bugs (#100011) next »