Hi all
François wrote: ....
Fatal error: mime_magic could not be initialized, magic file (null) is not avaliable in C:\apache2\htdocs\mediawiki15\includes\MimeMagic.php on line 476
This is a PHP issue - mime_content_type seems to be buggy under windows.
Possible solutions:
1) See http://www.php.net/manual/en/function.mime-content-type.php, about half way down the page:
The function mime_content_type only worked for me on Microsoft Windows after I added the directive "mime_magic.debug" to my php.ini with the value of "On". The default value appears to be "Off". Exampe:
[mime_magic] mime_magic.debug = On mime_magic.magicfile = "c:\php\extras\magic.mime"
2) Install PHP with the fileinfo extension enabled (see http://pecl.php.net/package/fileinfo). MediaWiki will use it instead of mime_content_type, if it's available. Note that this probably also uses a mime.magic file somewhere, somehow...
If (and only if!) you install fileinfo as a shared library, also set $wgLoadFileinfoExtension= true; in LocalSettings.php.
3) Use an external program for mime detection by setting $wgMimeDetectorCommand (in LocalSettings.php) to a command that will return the mime type of a file. Under linux, "file -bi" works fine, but that is not available under windows without a little fiddling. You might get it to work via cygwin.
I hope this helps - please give feedback which solution works for you, so other people running 1.5 under windows have an idea how to solve this problem.
Thanks for giving feedback! -- Duesentrieb
Hi,
thanks for your answer. I really don't know why previous versions of MW worked out of the box and not this one anymore. I'll try to find a copy of php compiled with mime-magic. As a matter of fact, I've got a mime-magic.dll in the extensions, but nothing like a MimeMagic.php file.
Thanks again
françois
Daniel Kinzler wrote:
Hi all
François wrote: ....
Fatal error: mime_magic could not be initialized, magic file (null) is not avaliable in C:\apache2\htdocs\mediawiki15\includes\MimeMagic.php on line 476
This is a PHP issue - mime_content_type seems to be buggy under windows.
Possible solutions:
about half way down the page:
The function mime_content_type only worked for me on Microsoft Windows after I added the directive "mime_magic.debug" to my php.ini with the value of "On". The default value appears to be "Off". Exampe:
[mime_magic] mime_magic.debug = On mime_magic.magicfile = "c:\php\extras\magic.mime"
- Install PHP with the fileinfo extension enabled (see
http://pecl.php.net/package/fileinfo). MediaWiki will use it instead of mime_content_type, if it's available. Note that this probably also uses a mime.magic file somewhere, somehow...
If (and only if!) you install fileinfo as a shared library, also set $wgLoadFileinfoExtension= true; in LocalSettings.php.
- Use an external program for mime detection by setting
$wgMimeDetectorCommand (in LocalSettings.php) to a command that will return the mime type of a file. Under linux, "file -bi" works fine, but that is not available under windows without a little fiddling. You might get it to work via cygwin.
I hope this helps - please give feedback which solution works for you, so other people running 1.5 under windows have an idea how to solve this problem.
Thanks for giving feedback! -- Duesentrieb
Hi,
Fatal error: mime_magic could not be initialized, magic file (null) is not avaliable in C:\apache2\htdocs\mediawiki15\includes\MimeMagic.php on line 476
This is a PHP issue - mime_content_type seems to be buggy under windows.
today I recognized, that my MW 1.5.0 running on Debian Testing produces the same error:
Fatal error: mime_magic could not be initialized, magic file /usr/share/misc/file/magic.mime is not available in /var/www/mediawiki-1.5.0/includes/MimeMagic.php on line 476
I'm not sure what triggers the bug, since I got other pages containing images that work well.
Possible solutions:
Before I try these possible solutions, are there any other suggestions for the Linux case?
Cheers,
- Mo
Ok,
solution 3 works on Linux.
That means putting
$wgMimeDetectorCommand = "file -bi";
into the LocalSettings.php.
Thanks to Daniel!
- Mo
mediawiki-l@lists.wikimedia.org