## How To Enable the PHP Fileinfo Extension under Windows

Tuesday, 30 November 2010

These five steps will hopefully help you to enable the Fileinfo extension for PHP under Windows. These steps assume you have the extension installed (e.g. php\ext\php_fileinfo.dll). They worked for me using Xampplite 1.7.1 and PHP 5.2.9.

2. Extract the contents of file-4.23-bin.zip\share\file\ to a folder on your machine - I went with path\to\xampplite\php\extras\magic\
3. Add an environment variable, named MAGIC, to your machine with the value pointing at the file named magic - in my example: path\to\xampplite\php\extras\magic\magic
4. Add a line (or uncomment an existing line) to your php.ini: extension=php_fileinfo.dll
5. Restart Apache if it was already running.

That's it!

These steps are probably what you need if you are seeing errors such as these:

• Failed to load magic database
• Fileinfo could not load the magic file
• The given magicfile can not be read
• The given magicfile is not accepted by finfo

(The last two of these error messages are specific to Zend Framework)

References: