在Mac Catalina上安装和配置新的php版本

在Mac Catalina上安装和配置新的php版本,php,macos,homebrew,Php,Macos,Homebrew,当我得到mac时,它已经安装了PHP7.3。我用Brew将新版php安装到/usr/local/cillar/php/7.4.9/bin/php并编辑了~/bash_profile,其中添加了 export PATH="/usr/local/Cellar/php/7.4.9/bin:$PATH" export PATH="/usr/local/Cellar/php/7.4.9/sbin:$PATH" 然后做了source.bash\u profile。它

当我得到mac时,它已经安装了PHP7.3。我用Brew将新版php安装到
/usr/local/cillar/php/7.4.9/bin/php
并编辑了
~/bash_profile
,其中添加了

export PATH="/usr/local/Cellar/php/7.4.9/bin:$PATH"
export PATH="/usr/local/Cellar/php/7.4.9/sbin:$PATH"

然后做了
source.bash\u profile
。它适用于当前的终端窗口,但其他终端窗口仍然使用较旧的PHP版本
/usr/bin/PHP
,即使在重新启动之后也是如此。甚至PhpStorm中的插件也声称php版本更旧。有什么帮助吗?

您可以尝试以下方法

  • brew取消链接php@7.3
  • brew链接php@7.4--强制--覆盖
  • brew服务启动php@7.4

  • 遗憾的是,由于php的第一次安装不是使用Brew完成的,因此取消与Brew的链接没有任何效果。在这种情况下,
    Brew升级php
    ,然后
    Brew取消与php的链接和Brew链接--覆盖php@7.4
    可能会有帮助。