Sam's notebook


 «   »

I have been pulling my hair out this morning trying to get the PHP Fileinfo extension working under PHP 5.2.14 on Windows Server 2003 SE. Actually, to be accurate: I’ve been trying to get the PHP Fileinfo extension working; the pulling out of hair is a normal occurrence when doing anything on a Windows server, I am learning.

Last week I ended up installing PHP 5.2 rather than 5.3, all because I read that the LDAP extension wasn’t yet available for 5.3 on Windows. Then this week it looks like Fileinfo is available for 5.3 but not 5.2! Why oh why did I agree to move to a blasted Windows machine from my nice well-setup and working Ubuntu box?!

Anyway, I tried to install Fileinfo from PECL (with the same result with both the pecl and pear commands):

D:>pear install pecl/fileinfo
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources"
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
ERROR: The DSP Fileinfo.dsp does not exist.

PECL bug #12603 is about this problem, but is still open and was no help.

The solution:

I’ll skip the details of the loops and deadends I traversed in trying to fix this. There were different PHP version, different DLLs, and any number of forums and Scroogle searches, but ultimately I:

  1. went down the list of old PHP releases to the most recent 5.2 release that had a separate Collection of PECL modules; this was 5.2.5, and I downloaded it;
  2. copied the php_fileinfo.dll from and put it where all the other extensions live;
  3. added the extension=php_fileinfo.dll line to php.ini; and
  4. restarted Apache.

So simple, and magically everything now works! So I thought I’d post this here, in case anyone else’s having the same problem. I’ll add a note to that bug report too.

[7 comments] [Keywords: , , , ] [Permanent link]


  1. On December 15th, 2010 at 08:56, Sam Wilson said:

    One other thing that I’ve done, in order to use code written for 5.3 (specifically Kohana’s File::mime() method), is:



  2. On December 22nd, 2010 at 21:34, Francisco said:

    Cheers mate, you saved the little left of my hair. ta


  3. On August 31st, 2011 at 22:36, John said:

    Sam, I’m trying to get the php_fileinfo.dll set up using windows 7, IIS 7.5, PHP 5.2.17.
    have you had any luck, or comments from folks with this issue using IIS?

    I’ve followed your advice above and have had no luck getting the file to actually load.

    I get a 500 error with this in the log:
    PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files (x86)\PHP\v5.2\ext\php_fileinfo.dll’ – The specified module could not be found.
    in Unknown on line 0

    push me in a new direction. please.


  4. On September 1st, 2011 at 14:21, Sam Wilson said:

    @John: I assume the file is actually at C:\Program Files (x86)\PHP\v5.2\ext\php_fileinfo.dll? If it is, I’ve no idea why PHP can’t find it, sorry! Perhaps some permissions problem on that particular file? I gave up trying to use IIS ages ago; it’s too confusing, and I’d rather keep my Apache skills—they’re useful in more places… :-)


  5. On April 20th, 2012 at 07:00, Brent said:

    This is a bug in the PEAR scripts that has been going on for years.

    This bug is the root cause of the problem:


  6. On February 17th, 2015 at 10:11, p90x nutrition plan book said:

    Hi, the whole thing is going well here and ofcourse every one is sharing information, that’s
    actually fine, keep up writing.


  7. On March 8th, 2015 at 02:50, ????? ??? nod32 64 ??? said:

    Where to get yourself the same?,


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

« »