Platform: WinXP-SP2, PHP5.2.5, MySQL 5.0, Apache 2.2.8
After reading former notes, I wasn't able to load my magic database: 'magic.mime' file (donwloaded from GnuWin32 project, zipped with the binary files v4.21). I always got an invalid $finfo object or finfo_open(...) returned FALSE.
In order to be able to load the 'magic.mime' file, Fileinfo library (bundled in PHP5.2.5) also requires 'magic' file.
For example:
1. Database:
c:\php\magic.mime
c:\php\magic
2. PHP Code:
<?php
$filname = 'c:\php\php.ini';
$finfo = new finfo(FILEINFO_MIME, 'c:\php\magic');
if (!$finfo) return false;
echo $finfo->file($filename);
?>
For further info see: http://pecl.php.net/bugs/bug.php?id=7555
Pay attention to comments added by 'christophe dot charron dot xul at gmail dot com'
NOTE: Before upgrading to PHP5.2.5, I was working with PHP5.2.1 and it only required 'magic.mime' file.