Gerden Barker
Gerden Barker

Reputation: 41

How to replace an existing symlink?

I have two commands php72 and php in my terminal, I need to replace php72(7.2 version) with php(5.6 version)

because the composer that I use say's that I need php 7.2 version, and I don't know how to make the composer use the php72 command instead of php, but the other way is to change the symlink of php to php72

what I've tried:

ln -sf /usr/bin/php72 php

so the first path is the bin file of the php executionary file, and the second is the link name? should I set it to php? or what exactly should I put(a path to what?)

cause the command above didn't replaced the php after checking its version it was the same

Upvotes: 1

Views: 1415

Answers (1)

hassan
hassan

Reputation: 8288

You may update your alternatives as mentioned in comments as follows :

sudo update-alternatives --set php /usr/bin/php7.2 100

Or if you want to temporarily use a specific version of your PHP versions you can use composer under this version/bin as follows :

php7.2 /usr/bin/locale/composer

note that this path /usr/bin/locale/composer may differ on your environment.

Upvotes: 1

Related Questions