Instalación

Esta extensión está activada por defecto desde PHP 5.3.0. Antes de esta versión, fileinfo era una extensión PECL pero ya no se sigue manteniendo. Sin embargo, en las versiones anteriores a 5.3+ se deben usar » La extensión PECL discontinuada.

Usuarios de Windows deben incluir el fichero DLL php_fileinfo.dll en php.ini para activar esta extensión.

La librería libmagic está incluida en PHP, pero incluye cambios específicos para PHP. Existe un parche para libmagic llamado libmagic.patch que es actualizado periódicamente y puede ser encontrado en las fuentes de las extensiones fileinfo para PHP.

Histórico de actualizaciones de la librería incluida libmagic
PHP Versión Libmagic actualizado a Versión Notas
5.3.2 5.03  
5.3.0 5.02  

add a note add a note

User Contributed Notes 5 notes

up
0
mdahlke at pixelcarve dot com
14 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.
up
-1
abowers
11 years ago
Windows users: just edit php.ini and uncomment this line:

extension=php_fileinfo.dll

Remember to restart Apache for new php.ini to take effect.
up
-1
fuxa_kos at unihost dot cz
12 years ago
when you are compiling php from source yourself, with --disable-all
you need --enable-fileinfo
up
-2
darko at uvcms dot com
16 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.
up
-24
darko at uvcms dot com
16 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
extension=php_fileinfo.dll

2. Download GNU file package for windows
get it from here: http://gnuwin32.sourceforge.net/downlinks/file-bin-zip.php

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