D
D
dev212021-04-02 11:51:32
linux
dev21, 2021-04-02 11:51:32

How to choose php version for composer?

The server has php5.6 installed by default, but 7.4 is also available. I want composer to run with it. Or make an alias. Tried to do like this:

/usr/local/bin/composer_php7.4

#!/bin/bash
/opt/php74/bin/php /usr/local/bin/composer


But that's not how the parameters are thrown...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
ge, 2021-04-02
@gedev

You can add it to the ~/.bash_profile file (if needed for one user) or to the /etc/profile file (if needed for all users on the server):

export PATH=/opt/php74/bin/:$PATH
alias composer='/opt/php74/bin/php /usr/local/bin/composer'

Then relogin. Ready.

I
irishmann, 2021-04-02
@irishmann


path_to_php7.4 path_to_composer install
find out the paths in the folder where you work with composer

which php7.4
which composer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question