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
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
...
AI is reshaping the dev experience, with faster builds but adding more friction. See what 3,500 developers and managers say about productivity, tools, and team alignment in Atlassian’s State of Developer Experience report 2025.
Explore the report
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.