OSX El Capitan 永久更改 PHP 版本
OSX El Capitan Permanently change PHP version
我已经从这里 http://php-osx.liip.ch/ 安装了 PHP 7.0 并按照说明将新 php 添加到我的 $PATH
但在新终端 window php -v
仍然显示旧的默认版本。
如果我source .profile
或source .bash_profile
(两者都试过),则使用新版本
我什至在我的 .bashrc
中添加了新的 PHP 路径,但仍然没有成功。
如何让我的 mac 始终默认使用新版本的 PHP?
注意:
Symink 不是一个选项,因为我在 El Capitan。
~/.bashrc:
export PATH=/usr/local/php5/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.composer/vendor/bin:$PATH
您应该在 Mac 上使用 ~/.bash_profile
而不是 ~/.bashrc
文件。
如果source ~/.bash_profile
可以解决问题,说明打开新终端时文件没有被source。如果您使用 zsh
,您应该将 source ~/.bash_profile
添加到 ~/.zshrc
文件。
但是,brew
是更好的选择。
我已经从这里 http://php-osx.liip.ch/ 安装了 PHP 7.0 并按照说明将新 php 添加到我的 $PATH
但在新终端 window php -v
仍然显示旧的默认版本。
如果我source .profile
或source .bash_profile
(两者都试过),则使用新版本
我什至在我的 .bashrc
中添加了新的 PHP 路径,但仍然没有成功。
如何让我的 mac 始终默认使用新版本的 PHP?
注意: Symink 不是一个选项,因为我在 El Capitan。
~/.bashrc:
export PATH=/usr/local/php5/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.composer/vendor/bin:$PATH
您应该在 Mac 上使用 ~/.bash_profile
而不是 ~/.bashrc
文件。
如果source ~/.bash_profile
可以解决问题,说明打开新终端时文件没有被source。如果您使用 zsh
,您应该将 source ~/.bash_profile
添加到 ~/.zshrc
文件。
但是,brew
是更好的选择。