Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to fix SSH command running in wrong container?

ademir.desilva May 5, 2020


Hi all,

Deploying a PHP app, when running 'composer install' in the server it fails:

This package requires php ^7.2.5 but your PHP version (5.6.22) does not satisfy that requirement.

My bitbucket-pipelines.yml:

image: php:7.4-fpm
...
- pipe: atlassian/ssh-run:0.2.5
variables: SSH_USER: $MY_USER
SERVER: $MY_SERVER
MODE: 'script'
COMMAND: './bitbucket-deploy.sh'

bitbucket-deploy.sh

#!/bin/bash
composer install -o

The server has php 7.4 installed. If I run composer install manually, it works.

Somehow the command is running in a wrong place and I need to execute it in the remote server.

Any tips?


Thanks

1 answer

0 votes
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2020

I see two options here:

1.) Tell composer to ignore the PHP version and the extensions:

composer install -o --ignore-platform-reqs

 As this is unattended, also consider to disable interactivity and all scripts and plugins:

composer install --no-interaction --no-scripts --no-plugins -o --ignore-platform-reqs

or:

2.) Find the path to the correct PHP version on that system an execute composer with it:

/usr/bin/php7.4 -f "$(which composer)" -- install --no-interaction --no-scripts --no-plugins -o

The /usr/bin/php7.4 part is just exemplary, replace it with the correct one on that system. If I read it right you're able to login there and have the correct version:

$ which php
/usr/bin/php
$ php --version
PHP 7.2.30-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr 19 2020 07:50:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events