Navigate / search

How to install PHP ISAPI on Windows 2008 IIS7 x64

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.

Comments

Bill
Reply

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

Brandon
Reply

Thats alot for the guide, worked out great

[...] 1. Note that the new system is Windoes 2003 x64 SP2 * Are MySQL and PHP going to be happy under x64? o Looks like IIS will need to run as 32 bit to use PHP Enable 32 bit apps under IIS on x64: To enable IIS 6.0 to run 32-bit applications on 64-bit Windows 1. Open a command prompt and navigate to the %systemdrive%InetpubAdminScripts directory. 2. Type the following command: cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true" o MySQL: Use the x64 version of MySQL o http://www.videotutorialzone.com/web…-and-iis6.html o http://www.iishacks.com/index.php/20…2008-iis7-x64/ [...]

Mike Kay
Reply

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.

Jason
Reply

This worked great, I have even tested on IIS 7.5 in Windows 2008 R2 – RC1. Thanks.

Matt
Reply

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?

Nikko
Reply

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!

Stein-Tore
Reply

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.

Stein-Tore
Reply

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.

William
Reply

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.

Chris Stinson
Reply

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.

Dylan
Reply

Worked out the others, but

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

Thanks Stein-Tore

tk1
Reply

The sad thing is that PHP 5.3 versions do not include isapi anymore.

Pierre
Reply

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.

Quan
Reply

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

Leave a comment

name*

email* (not published)

website