一、前言
现在是2023年8月,我本想使用如下命令安装php7,
brew install php@7.4
但发现brew官方已经不支持

二、我是这样安装的
如果你本地没有安装过其他版本的php,命令如下
brew tap shivammathur/php
brew install shivammathur/php/php@7.4
brew link php@7.4
如果你之前安装过其他版本的php,需要先unlink一下,比如我的本地安装了php@8.1
brew unlink php@8.1
brew link php@7.4
三、安装brew-php-switcher
brew install brew-php-switcher
安装玩第二步以后基本可以实现了,也可安装这个brew-php-switcher包来切换php的版本
具体用法如下

切换的前提是你已经安装了多个版本的php
brew-php-switcher 7.4 -s
brew-php-switcher 8.1 -s
发表回复
要发表评论,您必须先登录。