Change Composer PHP Version Path Plesk

Mathieu Mourareau picture Mathieu Mourareau · Jul 13, 2017 · Viewed 7.5k times · Source

RESOLVED :

For plesk users you need to make nano .bash_profile when you are in the file add this line :

PATH=/opt/plesk/php/7.1/bin:$PATH 

it will work for ssh users !!

for root ssh user you can do :

export PATH=/opt/plesk/php/7.1/bin:$PATH;

Hope it will help

I try to say to composer that now he needs to look on the php version 7.1 wish is installed on my plesk serveur.

how i could do this ? i am not a pro in commands line.. i think i need to add this line

export PATH=/opt/plesk/php/7.1/bin:$PATH; in my .bashrc file but i really don't know how to access to this and how to add the line.

hope someone could help me for this, thanks a lot in advance.

Actually i need to do manualy this to update composer :

export PATH=/opt/plesk/php/7.1/bin:$PATH; php composer.phar update

Answer

taekwondoalex picture taekwondoalex · Dec 1, 2017

A slightly alternative version if it may help anyone:

Create an alias for composer and store it in /etc/profile.d (so it is available to all users)

cd /etc/profile.d
nano composer7.sh

In your file put this (adjusting for version & composer location):

alias composer7='/opt/plesk/php/7.0/bin/php /usr/local/bin/composer.phar'

Save the file and login again.

Your script can now be used from command line even if your installation of Plesk is running a different version of php. Now you can execute it like:

composer7 update