Windows Azure - PHP contributions

PhpAzureExtensions - CustomPhpIniModule

The CustomPhpIniModule is part of the PhpAzureExtensions subproject.

Introduction

In the current http://windowsazure4e.org, 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:

imageCAGT75AY.png

Edit Web.config

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

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

Here’s my complete Web.config:

<?xml version="1.0"?> 
<configuration> 
  <system.webServer> 
    <!-- DO NOT REMOVE: PHP FastCGI Module Handler --> 
    <handlers> 
      <clear /> 
      <add name="PHP via FastCGI" 
           path="*.php" 
           verb="*" 
           modules="FastCgiModule" 
           scriptProcessor="%RoleRoot%\approot\php\php-cgi.exe" 
           resourceType="Unspecified" /> 
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> 
    </handlers> 
    <!-- Example WebRole IIS 7 Configation --> 
    <defaultDocument> 
      <files> 
        <clear /> 
        <add value="index.php" /> 
      </files> 
    </defaultDocument> 

    <modules> 
      <add name="CustomPhpIniModule" type="PhpAzureExtensions.CustomPhpIniModule, PhpAzureExtensions"/> 
    </modules> 
  </system.webServer> 
</configuration>

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

Comments

No comments yet.