Posted by & filed under General, Internet Information Server, PHP, Windows / Server.

February 2011 Update: Click here if you are looking for Install instructions for PHP 5.3 on IIS 7/7.5.

With the release of Windows Server 2008 and IIS 7, Microsoft has included PHP5 FASTCGI support. ISAPI is still faster in my opinion, and if used correctly, very stable. PHP uses a 32-bit DLL so it will not work with an x64 system. There are several ports of PHP to x64, but all have proved to be unstable. Below I will outline the steps to install PHP 32-bit ISAPI on Windows 2008 x64 (and have it stable). Update: These instructions also work on Windows 2008 x86 (32-bit), just leave out steps 8 & 9.

  1. Install the PHP4 or PHP5 package (32-bit) in C:\PHP or wherever you like. Only use the Windows installer from php.net if you do not need any extensions. I would recommend downloading the PHP zip package.
  2. Update April 2010: The PHP VC6 x86 Thread Safe package is ideal for ISAPI on PHP 5.2.x. ISAPI is included in PHP 5.2.x, but not 5.3.x. If you want to use the 5.3.x branch with ISAPI you’ll need to compile it yourself! The VC6 Non-Thread Safe package is ideal for FastCGI implementations for 5.2.x. For 5.3.x branches, PHP has introduced VC9 packages, go here for 5.3.x install with VC9.
  3. Open the Internet Information Services (IIS) Manager.
  4. Double-click “Handler Mappings” from the main IIS screen.
  5. Click on “Add Script Map.”
  6. Set up the handler mapping for c:\PHP\php5isapi.dll with extension *.php and check to allow the ISAPI extension and execution of scripts.
  7. Double-click “ISAPI & CGI Restrictions” on the main IIS screen. Right-click on PHP and select “Edit Feature Settings” and check “Allow unspecified ISAPI modules.”
  8. Right-click on the Default Application Pool (or the one you want to use if more than one) and select “Advanced Settings.”
  9. Change the “Enable 32-bit Applications” to True. Click OK. This spawns the App Pool in 32-bit mode, so if you have other modules that need to be run in 64-bit mode, best to separate the website into two App Pools: one 32-bit and one 64-bit.
  10. Restart the server.
(2.13 out of 5)

17 Responses to “How to install PHP ISAPI on Windows 2008 IIS7 x64”

  1. Bill

    Good tip. Thanks for sharing. Enabling 32bit in advanced settings is what did it for me.

    Reply
  2. Mike Kay

    I am having issues installing PHP. The header here is to install on a 64 bit machine, but the msi install fails because it is a 32 bit app. I get an error message that this installer is not for your system. I’m trying to install manually, but it’s difficult. For just the php.ini file edit says it uses the registry key values that don’t exist as there is no install done. Anyway, I am trying to get 32 bit PHP installed on a 64 bit server. If anybody can point me in the right direction – any help would be most appreciated.

    Reply
  3. Matt

    I can’t seem to get it to recognize the mhash and pgsql extensions when running as isapi. If i run as php-cgi it works.. Anyone else see this?

    Reply
  4. Nikko

    THANKS!!!
    I was stuck and your article gave me the tip I was looking for (enable the 32 bit support in IIS pools)
    Thanks for having done this great article, it saved me a lot of time!

    Reply
  5. Stein-Tore

    Good to the point article.

    Matt wrote: “I can’t seem to get it to recognize the mhash and pgsql extensions when running as isap”.

    I got Win Web Server 2008 R2 x64 & IIS 7.5.
    Running PHP as isapi.

    Tried to load all extensions listed in the php.ini file.

    Some loaded, others didn’t.

    I only need php_mysql.dll which sadly didn’t load.

    Can’t say I have a clue as to why. all dll’s are in the folder extension_dir points to.

    Reply
  6. Stein-Tore

    Last missing piece for me to get php_mysql extension to work on ISS 7.5 on Windows Web Server 2008 R2 x64:
    copy C:\php\libmysql.dll to C:\Windows\SysWOW64

    So steps to get php_mysql extension loaded:
    1. in php.ini, make sure extension_dir points to where php_mysql.dll is.
    2. in php.ini, enable extension=php_mysql.dll
    3. copy C:\php\libmysql.dll to C:\Windows\SysWOW64

    That does it for me.

    Reply
  7. William

    This does indeed work with php-5.2.13-Win32.zip

    However, I am also using the Microsoft SQL Server Driver for PHP 1.1 and cannot get this to work with ISAPI PHP. I have gotten it to work with FastCGI PHP, but I prefer not to use that as it causes problems for other modules on my system.\

    I downloaded php-5.2.13-nts-Win32-VC6-x86.zip, but php5isapi.dll does not come included in that. It is odd, several of the releases do not come with php5isapi.dll installed, but they DO come with a pws-php5isaspi.reg registration file to register the path of the isapi DLL.

    Reply
  8. Chris Stinson

    The non thread safe (php-5.2.13-nts-Win32-VC6-x86.zip) php package will not include the ISAPI dll because ISAPI is for thread safe applications (ie. multi-threaded). The non thread safe package is meant for the cgi or fast-cgi install.

    The thread safe package (php-5.2.13-Win32-VC6-x86.zip) is what you want for an ISAPI install.

    Reply
  9. Dylan

    Worked out the others, but

    3. copy C:\php\libmysql.dll to C:\Windows\SysWOW64 is what fixed it for me :)

    Thanks Stein-Tore

    Reply
  10. Pierre

    hi,

    Just to say that for FastCGI, the VC9 package is a must. Also for ISAPI if you compile it yourself.

    Btw, our latest release does not support VC6 anymore.

    Reply
  11. Quan

    hi
    I installed memcache server. Memcache server works well. But phpinfo.php can not load memchace module. I copy extension = php_memcache.dll in php.ini.

    – copy php.ini to C\window\system32 and c\window

    Any idea to help?

    Thanks

    Reply

Trackbacks/Pingbacks

  1.  » Notes from Successful 3.0 to 3.7 upgrade and Linux to Windows Migration
  2.  PHP unter W2k3 64 Bit - Forum Fachinformatiker.de
  3.  How to Install PHP 5.3 FastCGI on Windows 2008 IIS 7 - IIS Hacks | Server and System Administration

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>