Hi. I use FileField 5.x-2.3-rc3 with MimeDetect 5.x-1.0-beta on my web hosting:
- PHP Version 5.2.4
- System FreeBSD 6.2-STABLE
I have this error on Status Report page
finfo_open() [<a href='function.finfo-open'>function.finfo-open</a>]: Failed to load magic database at '/home/html/enigmaczech.cz/public_html/sites/all/modules/content/mimedetect/magic'.
with red message
Mime Detection PHP FileInfo Extension
FileInfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module.
I test finfo_open() function in misc path but for me work only this variant finfo_open(FILEINFO_MIME) (without second parameter). Maybe we need test this and on this case use finfo_open() without second parameter.
Comments
Comment #1
dopry commentedNo, I specifically want to use the magic distributed with mime detect. I'll try to gain access to a freebsd machine to test out the magic installation on it. Can you try rebuilding the magic database to see if a local rebuild based on the distributed magic will work? I may need to have mime detect build the magic database from source if this proves to be a common portability problem.
Comment #2
havran commentedI try compile magic.mgc from magic file provide in MimeDetect 5.x-1.0-beta and i give many errors. I use command
file -C -m magicand i give:And finally:
I think on FreeBSD 6.2 is older version file library which not support some new magic file syntax. I have installed FreeBSD 7 on another machine and on this machine i compile provided magic file without problems.
Comment #3
kamazeuci commentedI have exactly the same problem. My server is FreeBSD also. I dont have the option for installing another version. Do I have a choice of using FileField with mimedetect or not?
thanks
Comment #4
havran commentedOn my site i replace line 36 in mimedetect.module:
into
but this only remove error report in site status page...
Comment #5
dejamuse commentedI've just encountered this problem on a FreeBSD 6.3 box. All of the proposed patches and fixes don't seem to work. The one patch I found seemed to apply to the installation script, not the module code. It's all rather confusing.
Can you briefly explain how the MimeDetect module installs its own magic files?
My system has them at /usr/share/misc/magic ... magic.mgc ... magic.mime ... magic.mime.mgc
The files in this directory are smaller than those in the mimedetect directory.
Should I be pointing fileinfo to the mimedetect directory or is the mimedetect module supposed to install them in the system directory? If the latter, is it ok to overwrite what's there?
There was mention of recompiling or reinstalling the magic file; how do I do this?
I am using KDE3.5.8 via PCBSD, so apparently other programs in KDE use the magic files that were already there. I obviously don't want to muck that up in the process.
Where do the magic files come from? If they need to be updated periodically, it would be nice to know how.
Thanks in advance, Jeff
Comment #6
eric_sea commentedI have the same status page red box error: "Fileinfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module."
I replaced the magic.* files in /usr/share/file with those provided in the module and now sitting in /public_html/sites/all/modules/mimedetect, simply renaming the original files to magic_orig.*; however, there was not magic.mime.mgc so I left the orig one as it was.
I then rebooted the server. Is it necessary to recompile Magic?... How?
The server is running:
* Ubuntu 8.04.2
* Apache 2.2.11 Running
* PHP Version 5.2.9
* MySQL 5.0.67 Running
* Java: j2re1.4
Comment #7
WorldFallz commentedI managed to solve this on my windows box running wampserver2 by replacing the magic files provided with mimedetect with the attached files (per some thread I found on a php forum). I spent quite a bit of time trying to fix this and this was the only way I could find. Everything seems to be functioning ok.
Comment #8
tsilovy commentedBonjour.
is there another solution? I am hosted on Hostingrails.com (beginner plan, a shared server, Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a DAV/2 mod_auth_passthrough/1.8 mod_bwlimited/1.4 PHP/5.2.3 SVN/1.5.0 Phusion_Passenger/2.1.3).
I have installed the mimedetect 6.x-1.2. I have seen there is another dev version. What about it ?
Comment #9
drewish commented#306217: Fileinfo could not load the magic file will allow people to configure their own path.
Comment #10
Anonymous (not verified) commentedI’ve just had the same problem.
Here’s how I corrected it in my case :
I edited the magic file that comes with mimedetect because, under Ubuntu, the file -C -m magic command gave me these lines :
magic, 2170: Warning: <= not supported
magic, 2910: Warning: description `Clarion Personal/Professional Developer (v2 and above) data fil' truncated
magic, 2921: Warning: description `Clarion Personal/Professional Developer (v2 and above) memo dat' truncated
magic, 2927: Warning: description `Clarion Personal/Professional Developer (v2 and above) help dat' truncated
magic, 5854: Warning: <= not supported
magic, 5857: Warning: <= not supported
magic, 7791: Warning: >= not supported
magic, 8599: Warning: escaped tab found, use \t instead
Here’s how I edited the above lines :
2170 → replace <= by < and add 1 to the following number (less than or equal to is not understood but less than is understood)
2910 → replace "v2 and above" by "v2+" (line is apparently too long)
2921 → replace "v2 and above" by "v2+" (line is apparently too long)
2927 → replace "v2 and above" by "v2+" (line is apparently too long)
5854 → replace <= by < and add 1 to the following number (less than or equal to is not understood but less than is understood)
5857 → replace <= by < and add 1 to the following number
7791 → replace >= by > and subtract 1 to the following number (0x200 → 0x1FF)
8599 → replace tabulation character right after \ by a the t letter (tabulation character is forbidden)
After these modifications, file -C -m magic works without any error message and generates the magic.mgc file.
Copying magic and magic.mgc back to the server (Debian with PHP 5.2.6-1+lenny3) does wonder as it is automatically recognized when you go under admin/report/status.
The only trouble that may happen from now on : an update of mimedetect and the old file coming back.
I’ve attached my modified magic if it can helps someone.
Comment #11
RaRi commented#7 doesn't help here ..
#10 does !!
Comment #12
lordmorgoth commented#10 worked like a charm thanks a lot zigazou !!
Server: Ubuntu 10.04 LTS x64 server, Php 5.3.2, Drupal 6.16
Comment #14
steveh7 commentedThe patch in #10 works but this has not been merged into 6.x-1.x-dev.
Comment #15
rnexussix commentedGetting "Fileinfo could not load the magic file". Running Drupal 6.17 on Ubuntu 10.04 LTS
Comment #16
funky2D commented#10 worked like a charm for me too, thanx zigazou !
Comment #17
moosh101 commentedHi,
I too was having problems with the FileInfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module. error message using Windows. I managed to fix the problem by downloading the Windows Package from Sourceforge.
Installation:
1. Add php_fileinfo.dll to the list of enabled extensions in your php.ini file:
extension=php_fileinfo.dll, or uncomment it if its commented. You will need to restart apache after making changes to the php.ini file.
2. Download GNU file package for windows:
http://gnuwin32.sourceforge.net/downlinks/file-bin-zip.php
3. Extract the folder Share/File from the zip file. This folder contains 2 files, magic and magic.mgc.
4. Copy these files to your mimedetect folder, such as sites/all/modules/mimedetect, overwriting the original files.
5. Re-activate the module and it should work.
All the best,
Shane.
Comment #18
perusio commentedWell if you read the README or followed the issue referred in #9 you would have found that you can quite easily fix this by adding:
to the
settings.phpfile.Why go through all the pains of editing a gigantic file that will get clobbered in a module upgrade?
Marking this fixed.
Comment #20
asb commentedHi,
I found these warnings quite accidentally when reviewing my webserver's
error.log:I hope that #18 fixes the issue for me, but I would like to change this report into a feature request:
Please check if the module and its requirements are fully operational and report back at
./admin/reports/statusThis status overview is intended for such notifications, and it would be really helpful if it'd be used!
Thank you, -asb
Comment #21
jcarlson34 commentedHad this issue too on Amazon's new Amazon Linux AMI. Posting in case others eventually have this issue.
The following worked for me:
Add the following to settings.php:
The magic file is located in /usr/share/misc/magic and magic.mgc is at /usr/share/misc/magic.mgc
There was a symbolic link for magic in /usr/share/file/ but not for magic.mgc. I added that symbolic link, re-enabled the module and it worked!
Comment #22
r_darling commentedI'm new to Drupal, and I have spent hours with this issue looking for a solution. It just can't be this tough of an issue. The path on my machine is:
c:\XAMPP\htdocs\drupal\sites\all\modules\mimedetect
I keep seeing references to UNIX/LINUX paths, but nothing referring to Windows, other than the post above. I downloaded and replaced the 2 files from sourceforge, replaced them and restarted Apache and mysql, and then the drupal admin.
I haven't run into ANY issues with any other module I downloaded. This is getting quite frustrating. Any help greatly appreciated.
Comment #23
hobbel commentedwell , its very sipmle r_darling
for windows and xampp all you have to do is
open settings.php under your default folder by sites.
make sure is writeable.
then you have to add the following at the end:
$conf = array(
'mimedetect_magic' => 'location',
);
so in your case:
$conf = array(
'mimedetect_magic' => 'c:\XAMPP\htdocs\drupal\sites\all\modules\mimedetect',
);
restart apache server: enable module ; and whow! : it works.
Comment #24
hongpong commentedfor unix issues #21 jcarlson34's help worked nicely. thanx
Comment #25
itzcoatl commented#10 Worked for me
Comment #26
e5sego commentedAs it seems there is no fielinfo lib installed on the server i have to sue, I added following line to settings.php and giot rid of the error:
$conf['mimedetect_magic'] = '';Not sure, it seems the lib provided by the module itself will be used in this case.
Comment #27
drbeaker commented#26 Worked here. #21 and similar did not work.
I'm running D7 on Centos 5.
file-4.17
magic file from /usr/share/file/magic
This magic file does not work, giving this error.
D6 on Centos 4
file-4.10
magic file from /usr/share/file/magic
Works without modification of settings.ini.
Comment #28
asb commentedError message on a Debian "Lenny" server:
FileInfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module.Magic file exists in usual location:
My
./sites/default/settings.phpinclude this line:This kept me scratching my head, until I remembered that this was a i18n site and I was also running different configurations at
./sites/*/settings.php. I added the $conf variable to the other configs, the the error was gone. So double check which settings.php you are actually using ;)Comment #29
jcarrig commentedRunning CentOS 5, PHP 5.3.8 and #10 worked for me! Thanks zigazou!
Comment #30
jlongbottom commentedThanks zigazou
Comment #31
ph7 commentedIt removes the error but does it solve the problem?
Status report shows Mime detection is available
Any suggestions on how to further test/debug this functionality?
Comment #32
manuel.adanClosing this as outdated, feel free to re-open if you're still looking for a solution and waiting for appropriate assistance.