Red Hat Bugzilla – Bug 235110
Failed to load magic database at '/usr/share/misc/magic'
Last modified: 2007-11-30 17:12:01 EST
Description of problem:
Warning: finfo_open(): Failed to load magic database at '/usr/share/misc/
magic'. in /home/robert/test.php on line 2
Warning: finfo_file(): supplied argument is not a valid file_info resource in /
home/robert/test.php on line 3
Warning: finfo_close(): supplied argument is not a valid file_info resource in /
home/robert/test.php on line 4
The file test.php contains:
$finfo = finfo_open(FILEINFO_MIME);
echo finfo_file($finfo, "/bin/cp");
Version-Release number of selected component (if applicable):
Everytime, see above.
Not working php-pecl-Fileinfo package.
Working php-pecl-Fileinfo package.
A hackish workaround is "$finfo = finfo_open(FILEINFO_MIME, "/usr/share/file/
magic");" instead of "$finfo = finfo_open(FILEINFO_MIME);".
I'm also seeing this - the wierd thing is that /usr/share/misc/magic does exist.
The only difference between it and /usr/share/file/magic is that it is a
symbolic link to the real one.
This appears to be a feature of libmagic - a test program that calls
magic_load() on /usr/share/misc/magic fails with "No such file or directory" as
So either libmagic (part of file) needs to be fixed, or the php-pecl-Filesize
configure script needs to ignore symbolic links when looking for a magic file to
Fixed in php-pecl-Fileinfo-1.0.4-2.fc