简体   繁体   English

Mac OSX终端设置PHP路径不是永久的

[英]Mac OSX Terminal Setting PHP path not permanent

I've got a MAC OSX (Capitan to be precise). 我有一个MAC OSX(准确地说是Capitan)。

I have installed PHP7 by using this line of code in the terminal: 我已经在终端中使用以下代码行安装了PHP7:

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 PHP的-v

I get PHP 7.0.10 (cli) (built: Aug 31 2016 10:25:51) ( NTS )... 我得到PHP 7.0.10(CLI)(Build: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 什么时候需要它做,所以很棒,但是我的问题是,一旦我关闭终端并再次运行PHP -v,我就会得到PHP 5.5

Why doesn't it keep PHP 7.0 ? 为什么不保留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). export PATH=/usr/local/php5/bin:$PATH~/.profile文件中,以便在启动系统时导出PATH变量(需要重新启动)。

Or add it to ~/.bashrc file so that it gets exported when you start you start bash. 或将其添加到~/.bashrc文件,以便在启动bash时将其导出。

I recommend using ~/.profile . 我建议使用~/.profile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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