我刚通过命令行在终端更新了我的系统PHP.
我删除了.bash_profile中的导出路径,因为它指向mamp,但由于某种原因,当我在终端中运行PHP -v时,我的PHP仍然说5.3不是5.4.
有谁知道为什么会这样.我也关闭了终端并重新打开以查看更改.
解决方法:
好像你没有为$PATH添加新路径.
引用您发布的website的常见问题解答:
Why does PHP -v on the command line still show my old version?
PHP-osx doesn’t overwrite the PHP binaries installed by Apple, but installs everyting in /usr/local/PHP5. The new PHP binary is therefore in /usr/local/PHP5/bin/PHP.
You can also adjust your PATH do include that directory, eg. write into your ~/.profile file the following
export PATH=/usr/local/PHP5/bin:$PATH
因此,在nano或vim等编辑器中打开.profile或.bash_profile,并将最后一行导出PATH = /usr/local/PHP5 / bin:$PATH添加到适当的文件中.