Skip to content

SyntaxC4-MSFT/ComposerExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure App Service Web App Composer Site Extension

This site extension adds Composer support to Web App to enable dependency management for PHP applications.

Installation

Follow the instructions outlined in the article How to enable a Site Extension in Azure App Service Web App when selecting an extension look for the list item for Composer.

Usage

There are multiple ways to use Composer from Web App.

Continuous Deployment

This sample application demonstrates the usage of the composer.json file in Web App.

  • Place a composer.json file in the root of your repository
  • vendor folder will be created in d:\home\site\wwwroot\vendor (there is a rewrite rule enabled in the extension to protect against public access to the vendor folder)
  • reference to the autoload.php file require_once "vendor/autoload.php";

Command-Line

  • Open the Kudu Debug Console (http://<site-name>.scm.azurewebsites.net/DebugConsole) or Install KuduExec
  • run composer from the command line composer selfupdate

Timeout configuration

In some cases (especially when attempting to install great amount of packages, #1) the deployment may timeout and the dependencies won't get loaded correctly by Composer. A simple fix is to add a deployment configuration (create .deployment file) with parameter SCM_COMMAND_IDLE_TIMEOUT and set it to bigger number (for example SCM_COMMAND_IDLE_TIMEOUT=600 where 600 is time out in seconds). The default value in Azure Web Apps for this setting appears to be 400 seconds.

AppSettings

Name Value Notes
APPSETTING_COMMAND %XDT_EXTENSIONPATH%\Hooks\deploy.cmd Deployment Hook Command.
PATH %PATH%;%XDT_EXTENSIONPATH%\Commands;%APPDATA%\Composer\vendor\bin Overwrites the Path. Last Extension Wins
COMPOSER_ARGS --prefer-dist --no-dev --optimize-autoloader --no-progress Command line arguments for composer during deploy.cmd execution