@Sneha Rao Please use following steps in order to install & use composer in Azure App Service Linux
- Go to your KUDU console https://<sitename>.scm.azurewebsites.net or you can search Advanced Tools & click on Go button as shown below:
- Select WebSSH on the Kudu page to enter into the app container.
- Create a directory called ext inside your
/home/site
folder & download composer.phar by running the following commands :mkdir /home/site/ext
curl -sS https://getcomposer.org/installer | php
- Once composer.phar is installed , it can be run locally from the directory using php composer.phar, but to access composer globally, it has to be added into
/usr/local/bin/composer
directory during app container startup. To do this, create the startup.sh under/home/startup.sh
like so:cd /home
vi startup.sh
Press “i” on your keyboard to start editing and add the following.cp /home/site/ext/composer.phar /usr/local/bin/composer
Once, added, press Press “Esc”, then “:wq!” and enter to save. - Now provide the startup.sh file in App Service Application by selecting Configuration blade & then selecting General Settings and adding following command (/home/startup.sh) under Startup Command as shown below:
- After restarting the application, you can access composer globally in Kudu console & all changes made to application inside /home directory will persist.
Once Composer is installed globally, you can use it to manage dependencies in your PHP projects. Links- https://learn.microsoft.com/en-us/azure/app-service/configure-language-php?pivots=platform-linux
https://azureossd.github.io/2019/01/29/azure-app-service-linux-adding-php-extensions/
Let us know if further query.