IIS 7 and Above
fastCGI on windows XP
Last post Dec 19, 2013 06:09 PM by Mabel2
Dec 14, 2013 05:21 PM|Mabel2|LINK
I installed PHP on my Windows XP system using the Web Platform Installer (and probably somewhere choose to use 'FastCGI' as I had read this was the preferred way.) Under IIS 7.0, a simple PHP script produced an error "500.0 Internal Server Error'; detailed
underneath as an error in the FastCGI Module. The Trace-log file of IIS confirmed this and added 'Not a valid win32 application'.
Although I spent hours searching (and noted lots of people have a problem 'something like this'), I can't find a solution or even a way to go forward. I would be most grateful for a hint on how to proceed.
Here is what I did so far: On some forum I found the suggestion to use Dependency Walker on the file php-cgi.exe and sure enough it found some files missing. First, some C++ libraries; this issue I solved using a download from Microsoft.
The error remained the same, though, and Dependency Walker is still missing two files: wer.dll and ieshims.dll. I don't know how to repair this (downloading separate dll's doesn't seem a good idea) and in many forum answers to the same problem (missing these
two particular files when using Dependency walker) are given the advice that this is a 'fake' problem which should be ignored.
Meanwhile, I've been looking for an answer to this question: when I execute php-cgi.exe directly (I mean: double-clicking it with windows explorer) it gives the error "Not a valid win32 application". Is it supposed to do that? And if not, how could I proceed?
(By the way: php-win.exe gives the same error)
And if the error occurring when I directly execute php-cgi.exe is nothing to worry about - what, then, could be the problem?
Dec 16, 2013 08:47 AM|Terry Guo - MSFT|LINK
On a 64-bit (x64 or ia64) version of Windows XP iis 6 can run the AppPool (w3wp.exe) as 32-bit. In 6 this is configured through w3svc/apppools/enable32BitAppOnWin64, on 7
system.webServer/applicationPool/add@enable32BitAppOnWin64. On 6 it's a global setting. On 7, it's a per-app pool. To review your setting in 6 run "cscript c:\inetpub\adminscripts\adsutil
enum_all w3svc | findstr /i enable32bit", if nothing comes back, you're using the default (64-bit on x64)
To determine what bitness your w3wp.exe is, make a request, then open taskmgr (Ctrl-Shift-Esc), click on the "Processes" tab and looks for w3wp.exe. The ones with "*32" beside their names are 32-bit (aka wow64) processes.
In Windows DLLs must match the bitness of their host process. Our FastCGI is an ISAPI. ISAPIs are implemented in DLLs. So the fcgiext.dll bitness must match the w3wp.exe bitness.
Finally, for app-compat reasons, 64-bit Windows has a feature called Wow64 File System Redirection. This makes 32-bit processes that access \windows\system32, actually access \windows\syswow64 (the syswow64 directory has the 32-bit DLLs, yes that's tricky).
The FastCGI ISAPI fcgiext.dll is inside both the 64-bit (system32\inetsrv) and 32-bit (syswow64\inetsrv) directories. Cause of wow64 file system redirection, configuring the path to always be \windows\sytem32\inetsrv\fcgiext.dll, should result in using the
correct bitness fcgiext.dll.
Hope it helps.
Dec 19, 2013 06:09 PM|Mabel2|LINK
Thank you for your detailed answer and apologies for my late reaction as well as for the fact that I did not mention that I am talking about the 32-bit version of XP I use for 'development'. I did mention, though, that I'm talking about IIS Express 7. So
I'm not sure what I can learn from your answer. I'm still not any the wiser about the message 'not a valid win32 application' when I doubleclick on php-cgi.exe: is this an error to worry about? Do you think I somehow installed a 64-bit version? (I didn't even
know that existed, but would it install on a 32-bit system?)
And what about 'dependency walker': is it right in flagging those missing dll's (wer.dll and mshins.dll) as the cause of all troubles and if so, what should ]I do about it? Many people, apparently, bumped on the same problem, but nowhere did I find a discussion-thread
ending with a solution...
Did I install the wrong version of PHP? And if so, what version should I install?