note 88913 added to function.mime-content-type
| From: | francisco dot camps at gmail dot com | Date: | Fri, 13 Feb 2009 01:43:16 +0000 |
| Subject: | note 88913 added to function.mime-content-type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150602@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 80.64.47.13
Probable Submitter: 89.129.3.122
----
Manual Page -- http://www.php.net/manual/en/function.mime-content-type.php
Edit -- https://master.php.net/note/edit/88913
Del: integrated -- https://master.php.net/note/delete/88913/integrated
Del: useless -- https://master.php.net/note/delete/88913/useless
Del: bad code -- https://master.php.net/note/delete/88913/bad+code
Del: spam -- https://master.php.net/note/delete/88913/spam
Del: non-english -- https://master.php.net/note/delete/88913/non-english
Del: in docs -- https://master.php.net/note/delete/88913/in+docs
Del: other reasons-- https://master.php.net/note/delete/88913
Reject -- https://master.php.net/note/reject/88913
Search -- https://master.php.net/manage/user-notes.php