microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.2k stars 932 forks source link

https://github.com/microsoft/azure-pipelines-yaml/blob/master/templates/php.yml Not working #613

Open pritam97 opened 3 weeks ago

pritam97 commented 3 weeks ago

While setting up php version 8.2 getting below error

update-alternatives: error: alternative /usr/bin/php8.2 for php not registered; not setting update-alternatives: error: alternative /usr/bin/phar8.2 for phar not registered; not setting update-alternatives: error: alternative /usr/bin/phpdbg8.2 for phpdbg not registered; not setting update-alternatives: error: alternative /usr/bin/php-cgi8.2 for php-cgi not registered; not setting update-alternatives: error: alternative /usr/bin/phar.phar8.2 for phar.phar not registered; not setting

aleksandrlevochkin commented 3 weeks ago

Hi @pritam97, thank you for the question. Can I ask what pool you use in your pipeline? Do you use an MS hosted or self-hosted agent?

For example, for ubuntu-2204 the latest preinstalled version of PHP is 8.1.2: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#php-tools

In any case, I think you can install the version of PHP that you need in an earlier step in your pipeline and then use the same set of update-alternatives commands to set up symlinks

pritam97 commented 3 weeks ago

I am using microsoft hosted agent, but i want use php 8.2 or 8.3 above yaml is not working

aleksandrlevochkin commented 3 weeks ago

@pritam97 I think you can use a command from your distribution's package manager that will download the needed version of php just before this line: https://github.com/microsoft/azure-pipelines-yaml/blob/d0943c1b392250adb798993d782dbeb29af9e986/templates/php.yml#L17

Or you can switch to a pool such as ubuntu-2004, which has php 8.2 and 8.3 preinstalled: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md#php-tools