|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-05-04 05:13 UTC] humbads at alum dot mit dot edu
Description:
------------
The fileinfo extension won't recognize the magic database path, regardless of whether it is specified in the INI file or in the finfo constructor. Even if I put magic.mime in the root folder "C:\" or in the working folder ".", it doesn't work.
PHP.INI:
; path to mime types file
mime_magic.magicfile = "C:\Program Files\PHP\extras\magic.mime"
extension=php_fileinfo.dll
extension=php_mime_magic.dll
IUSR_MachineName has read & execute permission to the magic.mime file. Using latest release PHP 5.1.2 and PECL DLLs.
Reproduce code:
---------------
// ERROR ONE:
$finfo = new finfo(FILEINFO_MIME);
print $finfo->buffer("abc");
// Warning: finfo::finfo() [function.finfo]: Failed to load magic database at '(null)'.
// ERROR TWO:
$finfo = new finfo(FILEINFO_MIME, 'C:\Program Files\PHP\extras\magic.mime');
print $finfo->buffer("abc");
// Failed to load magic database at 'C:\Program Files\PHP\extras\magic.mime'
Expected result:
----------------
It should print the mime type.
Actual result:
--------------
Gives the warning described above, then gives a warning like "invalid fileinfo object" for the finfo->buffer statement.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 10:00:02 2025 UTC |
Same problem here! Help needed! ***** ***** win2000 (german) Apache/2.2.2 (Win32) PHP/5.1.4 ***** ***** php.ini includes "extension=php_fileinfo.dll", paths are set accurate, the file magic.mime is in the right directory ***** php-code: ***** $finfo = finfo_open(FILEINFO_MIME); foreach (glob("*") as $filename) { echo finfo_file($finfo, $filename) . "\n"; } finfo_close($finfo); ***** error: ***** Warning: finfo_open(): Failed to load magic database at '(null)'. in test.php on line 11 ***** by the way ***** By using "mime_content_type()" there is an error, too: Warning: mime_content_type(): mime_magic not initialized ***** ***** I need a way to identify my files urgently ...