我试图将我的 mba 的原生 php 从 5.3.X 更新到 5.4.X 我这样做了: brew tap Homebrew 软件/欺骗 brew tap josegonzalez/homebrew-php brew 更新 brew 安装 php54
这会在/usr/local/cellar/php54 上安装 php 5.4 现在在执行 which php 时,它给了我/usr/bin/php
我试图将其添加到 ~/.bashrc : 导出 PATH=/usr/local/cellar/php54:$PATH
现在当我重新打开终端并输入 which php 它仍然告诉我 php 位于/usr/bin/php
有什么好的方法可以解决这个问题吗?
最佳答案
来自 https://github.com/josegonzalez/homebrew-php
If you would like to swap the PHP you use on the command line, you should update the $PATH variable in either your .bashrc or .bash_profile:
# Swapping from PHP53 to PHP54 # export PATH="$(brew --prefix josegonzalez/php/php53)/bin:$PATH" export PATH="$(brew --prefix josegonzalez/php/php54)/bin:$PATH"
Please be aware that you must make this type of change EACH time you swap between PHP minor versions. You will typically only need to update the Apache/FPM when upgrading your php patch version.
关于php - mac 使用 Homebrew 软件升级 native php,无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18806532/