Sam Wilson's Journal

NewsPhotosArchivesContactWiki

 «   »

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 pecl-5.2.5-Win32.zip 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.

[11 comments] [Keywords: , , , ] [Permanent link] [50,476 views]

Comments:

  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:

    define('FILEINFO_MIME_TYPE', FILEINFO_MIME);

    [permalink]

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

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

    [permalink]

  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.
    thanks.

    [permalink]

  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… :-)

    [permalink]

  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: http://pear.php.net/bugs/bug.php?id=17016

    [permalink]

  6. On September 21st, 2014 at 13:16, dayz mods said:

    dayz mods

    Sam Wilson’s Journal » Windows

    [permalink]

  7. On September 21st, 2014 at 23:43, plagiarism articles said:

    plagiarism articles

    Sam Wilson’s Journal » Windows

    [permalink]

  8. On September 28th, 2014 at 11:12, samurai siege hacks said:

    samurai siege hacks

    Sam Wilson’s Journal » Windows

    [permalink]

  9. On October 2nd, 2014 at 14:54, videos download said:

    videos download

    Sam Wilson’s Journal » Windows

    [permalink]

  10. On October 6th, 2014 at 07:21, Plundernauts Cheats said:

    Plundernauts Cheats

    Sam Wilson’s Journal » Windows

    [permalink]

  11. On October 10th, 2014 at 11:32, dragons world hack android said:

    dragons world hack android

    Sam Wilson’s Journal » Windows

    [permalink]

Leave a Reply

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

÷ one = 7

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>

« »