Windows 2003 64-bit system PHP runtime error: 1% is not a valid Win32 application.

Published: 2012-02-22

Problem 1: PHP runtime error: 1% is not a valid win32 application

      After the PHP environment is configured, running HTML succeeds, but running PHP gives an error. The error message is “1% is not a valid win32 application”; the English message is %1 is not a valid Win32 application. This was the first time I encountered such a problem. After searching and experimenting, the problem was finally solved.

      Cause of the error: On a 64-bit operating system, under the default configuration, IIS runs in 64-bit mode, which prevents many 32-bit applications from working properly.

      Solution:

      1) Open Command Prompt: Start -> Run cmd

      2) Execute the script:

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

      Note: %SYSTEMDRIVE% represents the system drive. For example, if your system drive is C, then the above statement should be changed to:

      cscript c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

 

Problem 2: Error when accessing a web page: Service Unavailable

      After the above operations, I thought it was all done, but it was not. Accessing the website actually gave another error: Service Unavailable.

      The solution is as follows:

      1) Open Command Prompt: Start -> Run cmd

      2) Execute the script:

      %SYSTEMROOT%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -i

      Note: %SYSTEMROOT%\ represents the system directory, usually “C:\WINDOWS\”; v1.1.4322 is the default .NET version. You can also change it to other versions such as “v2.0.50727”. The key is not to write the path name incorrectly, otherwise execution will not succeed.