How to install php composer extension on azure web app?

Nelson Mendaros 61 Reputation points
2022-06-12T11:00:48.9+00:00

My existing Azure Web App is running on Linux PHP Laravel. I successfully deployed the app from bitbucket but I still need to install and run composer update inside azure web app.

The extension option in Deployment tool is disabled/grayed out.

210581-azurewebappextension.jpg

These recommendations does not work:

Running kudu says that data persist only on /home. So where to install composer and allow it to run?

210582-azurekudu.jpg

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

Accepted answer
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2022-06-14T20:08:45.81+00:00

    Hi @Nelson Mendaros ,

    Your app service should run composer if you're utilizing build automation.

    However, once you're SSH'd into your app service:

    1. Create an ext directory inside /home/site and download composer into that directory: mkdir /home/site/ext cd /home/site/ext curl -sS https://getcomposer.org/installer | php
    2. Once installed, you can run it locally but to access globally, it needs to be added into /usr/local/bin/composer during app startup. To do that, create startup.sh under /home using vi startup.sh (press "i") and add cp /home/site/ext/composer.phar /usr/local/bin/composer and save (press "Esc" then ":wq!")
    3. Change the Configuration > General Settings Startup Command to /home/startup.sh

    211433-image.png

    4 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.