user6734960
user6734960

Reputation:

Mac OSX Terminal Setting PHP path not permanent

I've got a MAC OSX (Capitan to be precise).

I have installed PHP7 by using this line of code in the terminal:

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0

After it installed I run this:

export PATH=/usr/local/php5/bin:$PATH

After this when I run:

PHP -v

I get PHP 7.0.10 (cli) (built: Aug 31 2016 10:25:51) ( NTS )...

when is what I need it to do, so great BUT my problem is that as soon as I close my terminal and I run PHP -v again I get PHP 5.5

Why doesn't it keep PHP 7.0 ?

Upvotes: 2

Views: 1927

Answers (1)

Gerard Roche
Gerard Roche

Reputation: 6381

Add export PATH=/usr/local/php5/bin:$PATH to your ~/.profile dotfile so that the PATH variable is exported when you start your system (requires restart).

Or add it to ~/.bashrc file so that it gets exported when you start you start bash.

I recommend using ~/.profile.

Upvotes: 2

Related Questions