可以同過brew list 來查看的php查看php的版本 例如:
brew list
brew unlink php56
brew link php55
大版本可以用brew list來查,如果是小版本的話只能去/usr/local/Cellar/php55看了。這個時候使用php-version可以更方便一點。 安裝非常簡單
brew install php-version
然後執行
source $(brew prefix php-version)/php-version.sh && php-version 5
使用php-version直接執行
php-version
就可以看到現有的版本,比如我自己的
$ php-version
5.5.15
5.5.16
5.5.17
然後使用以下命令切換即可
php-version 5.5.15
很多時候有些軟件會失去依賴關系和出現一些問題,這時候可以使用brew doctor
brew doctor
warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like soecho 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
這時候你就可以檢查一下的你的mac的配置適合否有問題了
轉載的原文:http://yansu.org/2014/09/26/use-old-version-of-brew-php.html