note 85559 deleted from ref.fileinfo by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 26 Apr 2011 09:51:44 +0000 |
| Subject: | note 85559 deleted from ref.fileinfo by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179151@lists.php.net to get a copy of this message | ||
Note Submitter: Philip Snyder
----
This module needs some serious work. I'm a well versed linux guy and it took me almost an hour
of hard research & trying this and that before I could actually get this to work.
mime_content_type() is supposed to be deprecated, but if this is the replacement, stick with
mime_content_type() as long as you can!
After reading the previously mentioned installation issues, I still had to have this modification:
$ apt-get install file-devel
$ wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz
$ tar -zxvf Fileinfo-1.0.4.tgz
$ cd Fileinfo-1.0.4
$ pecl install fileinfo
Note that there is no ./configure anymore -- and that the directory name changed. Trying to do the
pecl command first ended in failure.
On my Fedora 7 box, I also had to directly reference the magic db as follows before this would work:
$finfo = finfo_open(FILEINFO_MIME, '/usr/share/file/magic');
$mimeData = finfo_file($finfo, $file);
echo "<pre>mimeData: ".print_r($mimeData, true)."</pre>";
Without it, it tries to use a linked file (/usr/share/misc/magic) -- which just doesn't work
for some reason. I traced all the links, and they're right. Such basic functionality should not
be so hard to come by!