I have recently started working on 64-bit Windows servers more often and thought I’d share some of my experiences along the way.
One of the issues I encountered was with the installation of PHP on a 64-bit Windows Server 2003 R2 machine. The server already had IIS 6.0 installed so I downloaded the latest distribution of PHP and installed it in the usual way as described here How To Install PHP on IIS 6.0
[@more@]
The installation of PHP on IIS is pretty straightforward so I was a
little surprised when I was presented with the following error after
browsing to http://localhost to check that everything was working.

The first thing I always do when troubleshooting a problem is to make Internet Explorer give me a useful error message to work with. You can do this by clicking Tools | Internet Options | Advanced and then unticking ‘Show friendly HTTP error messages’ as shown here

Once this was done I was able to see the actual error message being returned to the browser as shown here :

Since my previous experience with 64-bit Windows and IIS was pretty limited I hadn’t encountered this particular error message before but a quick scan through the various newsgroups and Google quickly revealed the cause of the problem.
Without realising it I was trying to load a 32-bit application (in this case PHP) inside a 64-bit worker process and it was this that was causing the 500 Internal Server error I was seeing in my browser. Since the latest Windows distribution of PHP from www.php.net is only available in 32-bit version you need to configure IIS to run in 32-bit mode if you are using a 64-bit version of Windows.
This issue is discussed in this KB article Windows Server 2003 SP1 enables WOW64 compatibility for 32-bit Web applications in IIS 6.0 and also here How to switch between the 32-bit versions of ASP.NET 1.1 and the 64-bit version of ASP.NET 2.0 on a 64-bit version of Windows
In order to configure IIS to run in 32-bit mode you need to execute the following command :
cscript %SYSTEMDRIVE%inetpubadminscriptsadsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
This will set the Enable32bitAppOnWin64 metabase property to True as shown here :

It is important to note that IIS 6.0 does not support running in both 32-bit and 64-bit modes at the same time - in other words this is an ‘all or nothing’ system wide setting which affects all IIS web sites on the server, so if you need to run both 32-bit and 64-bit applications in IIS you will either have to locate them on separate machines or run them all in 32-bit mode.

Now, when I browse to http://local/index.php the page loads correctly and I can run PHP applications on my 64-bit IIS server.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9826/viewspace-1032974/ ,如需转载,请注明出处,否则将追究法律责任。