Tue, 20 Apr 2010

Changing Advanced FastCGI Settings for PHP Applications in Windows Azure

One of the things you can do with the Hosted Web Core Worker Role I blogged about earlier is to specify the full range of FastCGI settings, including those recommended by the IIS team. This goes beyond the settings that are allowed in web.roleConfig.

I’ve added a download to the Hosted Web Core Worker Role code over on Code Gallery that adds the following FastCGI settings to applicationHost.config:

  <application fullPath="{approot}\php\php-cgi.exe"
                maxInstances="4" instanceMaxRequests="10000" requestTimeout="180" activityTimeout="180">
      <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />

The PHP project also includes a sample web site with a web.config that configures index.php as a default document and registers the PHP FastCGI handler for files with the .php extension. To use the PHP project, you’ll need to download the latest binaries from php.net and add them under the php folder. Make sure there’s a php.ini file in the root of that folder.

To learn more about running PHP in Windows Azure, read “Using 3rd Party Programming Languages via FastCGI” from the Windows Azure blog.