$ brew install php54
$ brew install php70
如果安裝報以下錯誤:Error: Cannot install homebrew/php/php70 because conflicting formulae are installed.
php54: because different php versions install the same binaries.
Please `brew unlink php54` before continuing.
解決辦法有二種:1、brew unlink php542、刪除/usr/local/bin,下面有關php的軟鏈接上面2種方法,目的是一樣的。二、安裝切換工具php-version$ brew install php-version
$ source $(brew --prefix php-version)/php-version.sh
$ php-version
5.4.45
* 7.0.17
$ php-version 5.4.45 //切換到5.4
$ php-version
* 5.4.45
7.0.17
$ echo "source $(brew --prefix php-version)/php-version.sh" >> ~/.bash_profile
代碼如下復制代碼