Posts Tagged ‘fastcgi’

Using PHP FastCGI mode on Windows Server 2003 x64 w/ IIS in 32-bit mode

I recently needed to upgrade the PHP for a particular site from 5.2.6 to 5.3.0.  Of course, this is when I found out that PHP no longer supports the ISAPI module and instead wants you to use FastCGI.  Luckily I found a great article on how to configure IIS at http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/.  However, these instructions have some caveats in regards to running IIS in 32 bit mode on Windows Server 2003 x64.  To make a long story short, just like with most things running in 32 bit mode on x64, everything that references %WINDIR%\system32 really needs to point to %WINDIR%\SysWOW64.  If you use the fcgiconfig.js script, this will configure everything to point to %WINDIR%\system32.

  • The Web Service Extension needs to point to %WINDIR%\SysWOW64\inetsrv\fcgiext.dll.
  • The .php extension on the website also needs to point to %WINDIR%\SysWOW64\inetsrv\fcgiext.dll.
  • The fcgiext.ini file must also be located in %WINDIR%\SysWOW64\inetsrv.  Otherwise you will get a 500 error from FastCGI saying it cannot find the configuration file.

Note that the fcgiconfig.js script is only installed in %WINDIR%\system32\inetsrv.  I was able to create a fcgiconfigwow64.js file that points to the correct files.  The script needs to have at least an ini file with the “[Types]” section in the %WINDIR%\SysWOW64\inetsrv directory.  It also needs to be located under %WINDIR%\system32 as it doesn’t support running under Wow64.  You just need to change the following 2 lines near the top of the script.

From:

var g_iniPath       = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\system32\\inetsrv\\fcgiext.ini" );
var g_extensionPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\system32\\inetsrv\\fcgiext.dll" );

To:

var g_iniPath       = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\SysWOW64\\inetsrv\\fcgiext.ini" );
var g_extensionPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\SysWOW64\\inetsrv\\fcgiext.dll" );