The following forum(s) have migrated to Microsoft Q&A (Preview): Azure App Service - Web Apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
How to set FastCGI/Application settings (activityTimeout, requestTimeout, ...) for PHP 5.5 on Azure WebSites? RRS feed

  • Question

  • We have an application that is already running under PHP 5.5 on Azure WebSites.

    We followed the "official" instructions on how to setup a custom PHP version, as explained in "How to: Use a custom PHP runtime" (www.windowsazure.com/en-us/develop/php/common-tasks/configure-php-web-site ).

    In the backend, Azure management changed C:\DWASFiles\Sites\MySiteName\config\applicationhost.config with

    • Adding fastcgi/application
    • Adding Handlers/handler

    We do however need to change the activityTimeout and requestTimeout settings under fastCgi/application.

    Unfortunatelly, applicationhost.config seems to be readonly.

    We tried to add this to web.config but it doesn't seem to work.

    How can I add a custom PHP runtime using only changes in web.config?

    Thanks

    Wednesday, October 2, 2013 9:14 AM

Answers

  • [Relates to this discussion]

    We have a new mechanism that lets you modify applicationhost.config in arbitrary ways. You can see it documented here. Specifically, you'll be looking at using a 'Top level private extension' in this case.

    Monday, November 4, 2013 5:58 AM
    Moderator

All replies

  • I am actually investigating this right now with (I think) another customer. Once I have details, I will post back here.


    Jim Cheshire | Microsoft

    Wednesday, October 2, 2013 2:15 PM
    Moderator
  • Any news on this?

    Thanks

    Friday, November 1, 2013 3:11 PM
  • Hi, Joao. There may be a new way to do this, but I'm not sure yet. It will take a little more investigation. I will post back ASAP.


    Jim Cheshire | Microsoft

    Friday, November 1, 2013 5:23 PM
    Moderator
  • I would not mind an "old way" :)

    As of today, I had to revert to the default PHP 5.4, to have access to a larget timeout on FastCGI.

    C:\DWASFiles\Sites\mysite\config\applicationhost.config says 300s

    I tried to specify the <fastCgi> settings (application and handler) in my root web.config, but it doesn't work. Probably set as "no-override".

    Thx

    J

    Friday, November 1, 2013 11:00 PM
  • [Relates to this discussion]

    We have a new mechanism that lets you modify applicationhost.config in arbitrary ways. You can see it documented here. Specifically, you'll be looking at using a 'Top level private extension' in this case.

    Monday, November 4, 2013 5:58 AM
    Moderator
  • @David: Amazing! I'll start working on this today. Is it available today in Azure WebSites. Thank you very much
    Monday, November 4, 2013 11:07 AM
  • Thanks, David. Joao, yes, this is available now. It just hadn't been announced yet when I posted earlier so I had to wait on the announcement. :)


    Jim Cheshire | Microsoft

    Monday, November 4, 2013 1:20 PM
    Moderator
  • @Joao: please let us know how that goes. You'll probably among the first to try it, so any feedback would be great!
    Monday, November 4, 2013 11:48 PM
    Moderator
  • Hi,

    I have read the docs, and it seems extremelly powerfull.

    What I need to do is quite simple indeed, but I still have some questions on what needs to be done. Let me try to explain.

    • For now, we have no need to deploy any new app under .scm (although we will surelly use it for DevOps type pages)
    • We have an app already running under the MyWebSite.azurewebsites.net, using PHP 5.5.5 installed in wwwroot/bin/php555 via the old method
    • what we need is to set activityTimeout and requestTimeout under <fastCgi>/<application> (which means we probably need to change the <handler> setting

    This is what we tried so far:

    • set WEBSITE_PRIVATE_EXTENSIONS=1 in AppSettings (management page)
    • Turn off PHP in the management page (to make sure things work as result of the SiteExtensions actions)
    • upload an applicationHost.xdt to /site
    • restart the site

    The content of applicationHost.xdt is as follows:

    <?xml version="1.0"?>
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <system.webServer>
    <fastCgi>
    <application 
    fullPath="d:\home\site\wwwroot\bin\php555\php-cgi.exe" 
    activityTimeout="300" requestTimeout="300" instanceMaxRequests="11999" maxInstances="15" 
    xdt:Transform="Insert
    ">
    <environmentVariables>
    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="12000" />
    <environmentVariable name="PHPRC" value="d:\home\site\wwwroot\bin\php555\php.ini" />
    </environmentVariables>
    </application>
    </fastCgi>
    </system.webServer>

      <location path="">
    <system.webServer>
    <handlers>
    <add 
    name="PHP55_hsz_FastCGI" 
    path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="d:\home\site\wwwroot\bin\php555\php-cgi.exe" 
    resourceType="Either" 
    xdt:Transform="Insert"
    />
    </system.webServer>
      </location>
    </configuration>

    So far we haven't been able to get it to work. 
    We are inclined to the fact that we are uploading  applicationHost.xdt to the wrong place, or that the file has some error.
    Any help would be greatly appreciated.

    J

    Tuesday, November 5, 2013 12:25 AM
  • @Joao: I added a debugging section to the wiki page. Hopefully this will help you diagnose what's going on during the transform.
    Tuesday, November 5, 2013 1:39 AM
    Moderator
  • I did the debugging thing and you have a missing </handlers> tag. Try this:

    <?xml version="1.0"?>
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      <system.webServer>
        <fastCgi>
          <application
          fullPath="d:\home\site\wwwroot\bin\php555\php-cgi.exe"
          activityTimeout="300" requestTimeout="300" instanceMaxRequests="11999" maxInstances="15"
          xdt:Transform="Insert">
            <environmentVariables>
              <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="12000" />
              <environmentVariable name="PHPRC" value="d:\home\site\wwwroot\bin\php555\php.ini" />
            </environmentVariables>
          </application>
        </fastCgi>
      </system.webServer>
    
      <location path="">
        <system.webServer>
          <handlers>
            <add
            name="PHP55_hsz_FastCGI"
            path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="d:\home\site\wwwroot\bin\php555\php-cgi.exe"
            resourceType="Either"
            xdt:Transform="Insert"/>
          </handlers>
        </system.webServer>
      </location>
    </configuration>
    

    Then check the applicationhost.config to make sure it is what you want.

    Tuesday, November 5, 2013 1:57 AM
    Moderator
  • Joao,

    This might also help you.

    http://ctt.codeplex.com/


    Jim Cheshire | Microsoft

    Tuesday, November 5, 2013 2:08 AM
    Moderator