Homebrew安装(升级)php7.2
1、查看php版本
php -v
2、查找brew中PHP的版本
brew search php
3、brew安装PHP版本(版本名称跟搜到的php版本名称一样,如果已安装php,自动升级)
brew install [email protected]
启动php
brew services start [email protected]
4、查看安装好的php版本信息
brew info [email protected]
5、查看安装好的php路径
brew --prefix [email protected]
执行:
brew link php@7.2
6、修改 ~/.bash_profile
vi ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile
7、这个配置文件在修改后立即生效
source ~/.bash_profile
8、查看php版本
php -v