PHP 7.2.0 Release Candidate 4 Released


Cette extension est activée par défaut depuis PHP 5.3.0. Avant cette version, fileinfo était une extension PECL mais n'est plus maintenue en tant que tel. Cependant, les versions avant 5.3+ peuvent toujours utiliser » l'extension PECL non maintenue.

Les utilisateurs Windows doivent inclure la bibliothèque DLL fournie php_fileinfo.dll dans leur php.ini pour activer cette extension.

La bibliothèque libmagic est fournie avec PHP, mais embarque des changements propres pour PHP. Un patch de libmagic nommé libmagic.patch est maintenu et peut être trouvé dans la source de l'extension fileinfo de PHP.

Historique des mises à jour de la bibliothèque embarquée libmagic
Version PHP Version libmagic Notes
5.3.2 5.03  
5.3.0 5.02  

add a note add a note

User Contributed Notes 5 notes

4 years ago
Windows users: just edit php.ini and uncomment this line:


Remember to restart Apache for new php.ini to take effect.
mdahlke at pixelcarve dot com
7 years ago
I found that while using the magic files from GnuWin 4.23 worked great for the PECL extension with PHP 5.2 on Win32, when I started migrating to PHP 5.3 all of a sudden Fileinfo no longer worked.  Updating the magic files to the latest version (4.26 at the time of this writing) worked like a charm. 

I guess the bundled version of Fileinfo uses the new mime magic format while the old PECL version uses the old format.
darko at uvcms dot com
9 years ago
I need to add an addendum to the previous instalation steps.

Recently gnuwin32 project made a new release of file package (4.24). Binary release does not contain all needed magic files for fileinfo extension.
Instead of downloading latest version of file package (4.24) just get previous one (4.23) which does contain all of the needed files.
fuxa_kos at unihost dot cz
5 years ago
when you are compiling php from source yourself, with --disable-all
you need --enable-fileinfo
darko at uvcms dot com
9 years ago
It is really strange to find that installing filenfo extension on windows is not yet fully explained. Here are the latest most up-to-date steps to make this work:

1. Add php_fileinfo.dll to the list of enabled extensions

2. Download GNU file package for windows
get it from here:

Extract the folder from the archive called shared\file which contains 4 magic files (magic, magic.mgc, magic.mime, magic.mime.mgc).

3. Place these 4 files in a known place

4. Add system enviroment variable MAGIC that points to the file called magic. For example if you placed magic files in folder called magic in c:\php that means that the propper path is c:\php\magic\magic

5. If you use IIS restart it and fileinfo is ready for use

5a. If you use apache you will have to restart operating system for the service to acknowledge MAGIC env. variable.
To Top