1

I want to run composer update script for my PHP application hosted on Azure webapp. How can I include a startup shell script which can perform startup tasks in Azure webapp?

Ruchit Rami
  • 2,273
  • 4
  • 28
  • 53

2 Answers2

1

You could go with the available Composer Extensions for Azure Websites. As far as i know it will run composer on deployment or via the Kudu Console of your Application.

Azure Composer

opHASnoNAME
  • 20,224
  • 26
  • 98
  • 143
1

Generally speaking, you can install the Composer Extension, then you can leverage Visual Studio Online extension or Kudu Console site's cmdlet to run Composer scripts to maintain your dependencies. You can refer to the answer of How to install composer on app service? for how to enable the Composer Extension on Azure Web Apps.

Meanwhile, you can leverage the Web Jobs on Azure Web Apps to maintain your composer Extension on demand or on schedule. You can try to use the following PHP script to create the WebJob:

<?php
chdir('D:/home/site/wwwroot');
$output = exec("composer update");
echo $output;

Any further concern, please feel free to let me know.

Community
  • 1
  • 1
Gary Liu
  • 13,758
  • 1
  • 17
  • 32