Change composer PHP Version Path Plesk

IT WAS RESOLVED AS FOLLOWS:

For plesk users, you need to do 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 the root ssh user you can do:

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

      

Hope it helps

I am trying to tell the composer that he now needs to look at php 7.1 version. Desire is installed on my plesk service.

how could i do this? I am not a pro in command 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 this and how to add the line.

hope someone can help me on this, thanks in advance.

Actually I need to do it manually to update composer:

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

      

+4


source to share


2 answers


Slightly alternate version if it can help anyone:

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

cd /etc/profile.d
nano composer7.sh

      

In your file put this (setting for version and composer location):



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

      

Save the file and log in again.

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

composer7 update

      

+4


source


I had the same problem with Composer and WP CLI in Plesk Onyx environment

Issue 1 - This package requires php ^ 7.2, but your PHP version (5.4.16) does not meet this requirement.

And something similar when trying to start WP CLI

php -v

      

PHP 7.2.23 (cli) (built: Sep 27 2019 11:40:34) (NTS)

Solved it with a symbolic link like this

after logging in on the right domain with ssh:

cd /usr/bin
mv php php_OLD
ln -s /opt/plesk/php/7.2/bin/php php

      



and after checking cleaning:

rm php_OLD

      

I found very slowly that the php binary that both apps use is in / usr / bin

So what the code does:

  • go to this directory
  • rename php for backup
  • create a symbolic link to the correct path to the plesk php binary

worked instantly

hope this helps someone solve this puzzle faster than me ...

0


source







All Articles