I'm working on a Ubuntu 16 machine:
lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 16.04.6 LTSRelease: 16.04Codename: xenial
My experience with Ubuntu is "medium".
I needed to change the path the php
command refers to in alternatives.I did the following:
cd /etc/alternativesls -ls | grep php0 lrwxrwxrwx 1 root root 15 Mar 7 06:31 php -> /usr/bin/php7.0
I want to change the path /usr/bin/php7.0
to /opt/plesk/php/7.2/bin/php
.
The first thing I tried is update-alternatives --config php
.This gave me this:
There is 1 choice for the alternative php (providing /usr/bin/php).
Selection Path Priority Status------------------------------------------------------------ 0 /usr/bin/php7.0 70 auto mode* 1 /usr/bin/php7.0 70 manual modePress <enter> to keep the current choice[*], or type selection number:
Sadly, I can't add another path by using this command.
The second thing I tried to do is this: update-alternatives --set php /opt/plesk/php/7.2/bin/php
. The result of that:
update-alternatives: error: alternative /opt/plesk/php/7.2/bin/php for php not registered; not setting
The third attempt, I went to /etc/alternatives
and used unlink php
. Then I created a new symlink like this: ln -s /opt/plesk/php/7.2/bin/php php
.This changed the path in alternatives indead. See for yourself:
root@xxtweb03:/etc/alternatives# ls -ls | grep php0 lrwxrwxrwx 1 root root 26 Apr 4 12:18 php -> /opt/plesk/php/7.2/bin/php
It has only one disadvantage. When I run this command: update-alternatives --config php
then the /opt/plesk/php/7.2/bin/php
is not among the selection.
This is what I get:
root@xxtweb03:/# update-alternatives --config phpThere is 1 choice for the alternative php (providing /usr/bin/php). Selection Path Priority Status------------------------------------------------------------ 0 /usr/bin/php7.0 70 auto mode 1 /usr/bin/php7.0 70 manual mode
Question: how can I add /opt/plesk/php/7.2/bin/php
to the Path list that is displayed when running update-alternatives --config php
?