1
votes

I'm trying to deploy my PHP (CakePHP) application through Azure DevOps and install Composer dependencies in the build step of the pipeline, using a Windows hosted agent.

The composer install is failing because common PHP extensions (namely intl and fileinfo) are unavailable to the PHP executable running in the build. Once deployed, the Web App on Azure does have these extensions. The composer web app extension is installed on the actual app service on Azure and there is a composer.phar file in the root of the repository.

The step I'm trying to run is just php composer.phar install --no-scripts --no-interaction --optimize-autoloader.

The pipeline fails with this error, but I have no idea how to access the .ini file or provide any options.

To enable extensions, verify that they are enabled in your .ini files:
    - C:\tools\php\php.ini

PHP_INI_SCAN_DIR can be set, but this 'php template' from DevOps wipes out any added configuration properties when a new deploy happens. This also seems to be a totally different PHP than what the App Service actually runs. I can make a new template for config options, but the PHP extension issue seems to still be there on the build step.

If anyone knows how to simply have composer install dependencies and have them included in the build artifact (.zip file) created, I would greatly appreciate it. Thank you!

1
You can have a try modifying the C:\tools\php\php.ini to enable the extensions. for example run this command in pipeline scrpt task: echo "extension=intl" >> C:\tools\php\php.iniLevi Lu-MSFT

1 Answers

0
votes

As answered in the comment by Levi Lu-MSFT, I was able to modify the PHP configuration by adding a new build task using the Command Line task and entering:

echo extension=intl >> C:\tools\php\php.ini
echo extension=fileinfo >> C:\tools\php\php.ini

Adding quotes caused an issue, but without it seems to work.