简体   繁体   中英

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 ?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM