brew link php70
给我以下错误:
Warning: php@7.0 is keg-only and must be linked with --force
Note that doing so can interfere with building software.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/php@7.0/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.0/sbin:$PATH"' >> ~/.bash_profile
但在~/.bash_profiles
中:
PATH=$PATH:/usr/local/opt/php@7.0/bin
export PATH
请告诉我如何解决。
谢谢。
答案 0 :(得分:0)
在您的〜/ .bash_profile 文件中添加下一行:
export PATH="/usr/local/opt/php@7.0/bin:$PATH"
export PATH="/usr/local/opt/php@7.0/sbin:$PATH"
或者尝试在〜/ .bashrc 文件中添加下一行
export PATH="/usr/local/opt/php@7.0/bin:$PATH"
export PATH="/usr/local/opt/php@7.0/sbin:$PATH"
答案 1 :(得分:0)
我也遇到了类似的问题,请从终端上运行以下命令来修复它。
请注意,这是针对PHP@7.2的,我使用ZSH shell:
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.zshrc
因此您将运行:
echo 'export PATH="/usr/local/opt/php@7.0/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.0/sbin:$PATH"' >> ~/.bash_profile
然后,关闭并重新打开终端以使更改生效。