PHP on 64 bit Windows

Categories:

64-bit operating systems are becoming increasingly popular, not without teething pains though. When using IIS on 64 bit versions of Windows 32 bit applications are disabled by default. In this guide we'll look at how you can enable 32 bit support on your 64 bit Windows installation.

If you have tried running PHP on IIS on a default install of 64 bit version Windows, then you'll probably have seen this error in your Internet browser window;

%1 is not a valid Win32 application

This is because the Enable32bitAppOnWin64 metabase property in IIS is preventing the use of 32 bit applications. The solution is quite simple, simply open a command prompt and navigate to your C:\Inetpub\adminscripts directory and run this command;

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

From here you should be able to run PHP (and other 32 bit applications) on IIS when using a 64 bit version of Windows.

Average rating
(2 votes)

Comments

Anonymous's picture

Framework

As per my concern if i enabled the 32 bit application on 64 bit IIS6.0(win2k3(64bit)then i can use the 32 bit applications...right..? But how can i install 32 bit dotnet framework ?...Its giving error cannot install 32 bit framework on 64 bit operating system.

Anonymous's picture

Getting Service Unavailable

I am moving my websites from a 32 bit server to a 64 bit server. IIS 6 on both machines. Win 2000 on old server with Win2003 on new server.
I copied the PHP folder over to the new server, not sure what the version is but the files are dated 8/23/06. I then followed the setup instructions from here http://www.iis-aid.com/articles/how_to_guides/installing_php_5_iis_5_simple_steps?page=29%2C4 .

I was getting a HTTP 500 error. I then executed this: cscript "c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1". Then I started getting the Service Unavailable on the web page, and not just for my PHP pages, also for my .Net (.aspx) pages.

I then executed "cscript c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0", to turn off the 32 bit support. I then started to get the "%1 is not a valid Win32 application" message. So I tried turning on the 32 bit support again, but am still getting the Service Unavailable message.

Do you have any suggestions?

Anonymous's picture

Getting Service Unavailable

I found the problem.
Since the .aspx pages use the .Net framework, I had to tell IIS to use the 32bit version of the .Net framework. The application pool would crash if IIS would try to use the 32 bit PHP with the 64 bit .Net.

To change IIS to use the 32 bit version of the .Net framework run this: %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Thank you,
Chris

Brashquido's picture

Thanks for posting back

Glad you sorted it out. Thanks for posting back your solution!

----------------
Dominic Ryan
5 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

The AdminScripts directory

The AdminScripts directory is empty on my Win 7 system.

Brashquido's picture

Install IIS 6 component

I believe you need to install "IIS 6 Management Compatibility" to get that.

----------------
Dominic Ryan
6 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster