note 82551 added to function.finfo-open
| From: | dario dot borreguero at gmail dot com | Date: | Wed, 16 Apr 2008 10:15:42 +0000 |
| Subject: | note 82551 added to function.finfo-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138354@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 130.206.1.5
Probable Submitter: 193.33.2.101
----
Manual Page -- http://www.php.net/manual/en/function.finfo-open.php
Edit -- https://master.php.net/note/edit/82551
Del: integrated -- https://master.php.net/note/delete/82551/integrated
Del: useless -- https://master.php.net/note/delete/82551/useless
Del: bad code -- https://master.php.net/note/delete/82551/bad+code
Del: spam -- https://master.php.net/note/delete/82551/spam
Del: non-english -- https://master.php.net/note/delete/82551/non-english
Del: in docs -- https://master.php.net/note/delete/82551/in+docs
Del: other reasons-- https://master.php.net/note/delete/82551
Reject -- https://master.php.net/note/reject/82551
Search -- https://master.php.net/manage/user-notes.php