muffin
muffin

Reputation: 2104

Linux : Setting which php bin to use in CLI

Hi i'm trying to use php command in linux. However I have two installations of php, one I got from the sudo-apt-get and one from a stack, Lappstack. Don't ask how I got there, but nevertheless i'm trying to execute php in CLI .

$ php file.php

it both works whichever php it points to but I want to use the php that I use in the stack.

when I try to execute :

$ which php

It returns :

/usr/bin/php

But I have to use the php I have in my lappstack which is in :

/home/userName/lappstack/php/bin

How do I change the php bin that my CLI php points to?

Upvotes: 0

Views: 555

Answers (2)

webNeat
webNeat

Reputation: 2828

You can replace the php in /usr/bin by yours like this:

sudo rm /usr/bin/php
sudo ln -s /home/userName/lappstack/php/bin/php /usr/bin/php

Hope this helps

Upvotes: 1

doublesharp
doublesharp

Reputation: 27637

You can either have /home/userName/lappstack/php/bin first in your $PATH or use alias:

alias php='/home/userName/lappstack/php/bin/php'

Upvotes: 1

Related Questions