note 88913 deleted from function.mime-content-type by danbrown

From: Date: Fri, 13 Feb 2009 01:46:05 +0000
Subject: note 88913 deleted from function.mime-content-type by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150603@lists.php.net to get a copy of this message
Note Submitter: francisco dot camps at gmail dot com Reason: useless ---- This function is totally unusable on Windows. It simply won't work: you can surf the entire web and won't find anyone who has solved it. I have enabled extension=php_mime_magic.dll on php.ini; I've set C:\Program files\PHP\extras\magic.mime as the path for the magic file in php.ini too. I'm using the bundled file with the PHP package. mime_content_type will return always nothing. Then you set mime_magic.debug = On on php.ini and it will complain that "Warning: mime_content_type() [http://www.php.net/mime_magic]: mime_magic not initialized". Take a look at Apache's logs and you'll find the file isn't being loaded because it seems full of errors. This megabug is known at least since 2007, but the only official respone I've found googling is this: http://bugs.php.net/bug.php?id=38235&edit=1 What is telling jani@php.net is to use the fileinfo extension instead. He/she is arguing it will replace mime_content_type soon... That message is from 2007; current version oh PHP is 5.2.8 and it hasn't replaced it yet; it's said it's done on 5.3, but that's a beta version! Moreover: what is worst is that, even using fileinfo as an extension in the current version... IT IS BUGGY TOO! You have to do a lot of tricks, download files from the fileinfo stand-alone program, and even that, still you have to override the mime_magic.magicfile path in your script, and put the filename without extension to get it work (this has needed a lot of research from users in the net as you can guess googling). So it don't seems to be much usable if you have to hard-code paths and filenames in your script. Also you have to know paths on your hosting server. As a grand finale, I've discovered that the finfo_file function only works with ABSOLUTE names for your files. I have only one word to describe this: BULLSHIT. I've spent the entire day trying to solve this, but it cannot be done. It's LAMENTABLE. I've seriously considering switching to a different language. This is not serious. It's a trivial function! The bugs are reported from several years now! This is not tolerable for a production.

« previous php.notes (#150603) next »