Windows Azure - PHP contributions

PhpAzureExtensions - CustomPhpIniModule

The CustomPhpIniModule is part of the PhpAzureExtensions subproject.


In the current, there is no possibility to edit php.ini before deploying it. The CustomPhpIniModule allows you to specify a different php.ini file.

The custom php.ini file should be located in the root of your application. As a bonus, the %RoleRoot% variable in php.ini will be automatically replaced with the full role root path known to the Windows Azure environment.

There are 3 steps involved in using the Windows Azure Drive HTTP module:
  1. Copy the .NET assemblies into your project
  2. Edit Web.config
  3. Have php.ini ready

Copy the .NET assemblies into your project

Create a /bin folder in your web role project and copy in all .DLL files provided. Here’s a screenshot of how this looks:


Edit Web.config

Before the HTTP module is used by IIS7 or Windows Azure, the following should be added to Web.config:

  <add name="CustomPhpIniModule" type="PhpAzureExtensions.CustomPhpIniModule, PhpAzureExtensions"/> 

Here’s my complete Web.config:

<?xml version="1.0"?> 
    <!-- DO NOT REMOVE: PHP FastCGI Module Handler --> 
      <clear /> 
      <add name="PHP via FastCGI" 
           resourceType="Unspecified" /> 
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> 
    <!-- Example WebRole IIS 7 Configation --> 
        <clear /> 
        <add value="index.php" /> 

      <add name="CustomPhpIniModule" type="PhpAzureExtensions.CustomPhpIniModule, PhpAzureExtensions"/> 

Have php.ini ready

Have a php.ini file in the root of your Windows Azure role. Enabling the CustomPhpIniModule will pick up this php.ini file instead of the default by modifying the PHPRC environment variable.

Last edited Apr 20, 2010 at 5:28 AM by maartenba, version 4


No comments yet.