php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56958 FileInfo Error
Submitted: 2006-04-13 11:53 UTC Modified: 2006-04-24 15:35 UTC
From: nimshon at gmail dot com Assigned:
Status: Not a bug Package: Fileinfo (PECL)
PHP Version: 5.1.0 OS: FreeBSD 6.0 i386
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nimshon at gmail dot com
New email:
PHP Version: OS:

 

 [2006-04-13 11:53 UTC] nimshon at gmail dot com
Description:
------------
Error in the Fileinfo Package, can't use it...
(I have php 5.1.2 but it doesn't appear in the versions list)

Reproduce code:
---------------
<?php
$finfo = finfo_open(FILEINFO_MIME); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
   echo finfo_file($finfo, $filename) . "\n";
}
finfo_close($finfo);
?> 

(Taken from the manual http://www.php.net/manual/en/function.finfo-file.php )

Expected result:
----------------
i expected the page to display the mimetypes of the files in the script's dir

Actual result:
--------------
Warning: finfo_open() [function.finfo-open]: Failed to load magic database at ''. in /usr/home/http/html/fileinfo.php on line 10

Warning: finfo_file(): supplied argument is not a valid file_info resource in /usr/home/http/html/fileinfo.php on line 13

(...)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-13 12:38 UTC] wiesemann@php.net
(wrong package)
 [2006-04-13 13:06 UTC] nimshon at gmail dot com
what do you mean "wrong package" ? i found it on this website !
http://pecl.php.net/package/Fileinfo
 [2006-04-14 08:29 UTC] mike@php.net
Sorry, this means that fileinfo didn't find your magic.mime database at build time, specify the path to it in the second argument to finfo_open().
 [2006-04-24 15:35 UTC] nimshon at gmail dot com
but I dont know the path to it :(
how can I know?
(Thanks)
 [2006-09-27 09:54 UTC] florin dot cojocarut at gmail dot com
I have already done what 'mike at php dot net' said and the error still the same. 
Someone said, that in php 5.1.4 we must give the path to "magic.mime" file without extension as "X:/path/to/extras/magic". Looks like it works, but when I used it, the finfo_file function return only one type of file from "magic.mime" database for all tested files.
Anyone could help with a older version of php_fileinfo.dll compiled for php 5.1.4???
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 02:03:37 2021 UTC