Конвейер не может изменить версию PHPPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Конвейер не может изменить версию PHP

Сообщение Anonymous »

У меня есть проблемы с сбоем трубопровода, потому что он не настраивает правильную версию PHP, которая затем заставляет композитор для сбоя, но при вручную запускает одни и те же команды и проверяя версию PHP, правильно установлена ​​версия.# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops ... guages/php

trigger:
- master

pool:
vmImage: ubuntu-latest

variables:
phpVersion: 7.4

steps:
- script: |
sudo update-alternatives --set php /usr/bin/php$(phpVersion)
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
php -version
displayName: 'Use PHP version $(phpVersion)'

- script: composer install --no-interaction --prefer-dist
displayName: 'composer install'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(system.defaultWorkingDirectory)'
includeRootFolder: false
- task: PublishBuildArtifacts@1

< /code>
Неудачный журнал заданий показывает следующее < /p>
Starting: Use PHP version 7.4
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops ... mmand-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/7743b650-1902-47f9-ae80-b9ee9186f3bb.sh
update-alternatives: error: alternative /usr/bin/php7.4 for php not registered; not setting
update-alternatives: error: alternative /usr/bin/phar7.4 for phar not registered; not setting
update-alternatives: error: alternative /usr/bin/phpdbg7.4 for phpdbg not registered; not setting
update-alternatives: error: alternative /usr/bin/php-cgi7.4 for php-cgi not registered; not setting
update-alternatives: error: alternative /usr/bin/phar.phar7.4 for phar.phar not registered; not setting
PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies
with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
Finishing: Use PHP version 7.4

< /code>
Ранее этот трубопровод работал, и журнал показал: < /p>
Starting: Use PHP version 7.4
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops ... mmand-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/2a36edba-2975-4d4b-906d-f1e2f0e869a7.sh
update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in manual mode
update-alternatives: using /usr/bin/phar7.4 to provide /usr/bin/phar (phar) in manual mode
update-alternatives: using /usr/bin/phpdbg7.4 to provide /usr/bin/phpdbg (phpdbg) in manual mode
update-alternatives: using /usr/bin/php-cgi7.4 to provide /usr/bin/php-cgi (php-cgi) in manual mode
update-alternatives: using /usr/bin/phar.phar7.4 to provide /usr/bin/phar.phar (phar.phar) in manual mode
PHP 7.4.33 (cli) (built: Nov 8 2022 11:33:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
Finishing: Use PHP version 7.4

< /code>
Я имею вручную запустить следующие команды для обновления альтернатив и установить версию PHP на моем сервере Ubuntu: < /p>
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set phar /usr/bin/phar7.4
sudo update-alternatives --set phpdbg /usr/bin/phpdbg7.4
sudo update-alternatives --set php-cgi /usr/bin/php-cgi7.4
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
php -version

< /code>
, который выводит следующее: < /p>
user@server:~$ sudo update-alternatives --set php /usr/bin/php7.4
user@server:~$ sudo update-alternatives --set phar /usr/bin/phar7.4
user@server:~$ sudo update-alternatives --set phpdbg /usr/bin/phpdbg7.4
update-alternatives: error: alternative /usr/bin/phpdbg7.4 for phpdbg not registered; not setting
user@server:~$ sudo update-alternatives --set php-cgi /usr/bin/php-cgi7.4
user@server:~$ sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
user@server:~$ php -version
PHP 7.4.33 (cli) (built: Jun 8 2023 15:22:42) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

< /code>
Так что, похоже, я могу вручную изменить версию PHP, но трубопровод не может этого сделать. Любая помощь в решении этой проблемы будет очень признателен, спасибо!>

Подробнее здесь: https://stackoverflow.com/questions/765 ... hp-version
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»