[Mediawiki-l] Re: 1.5.0 mime_magic crash

Daniel Kinzler daniel at brightbyte.de
Fri Oct 7 23:22:10 UTC 2005


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



More information about the MediaWiki-l mailing list