php是為了快速構建一個web頁面而迅速被大家廣為接受的開源語言,通過不斷發展已經有了很多的php開源系統,滿足了目前大部分用戶的站點需求。1995年初php誕生到現在已經存在多個版本,並且每個版本都屬於一個系列,大多數網站源碼都不能相互兼容,所以能夠快速的切換PHP版本還是很實用的。
注意:要求所有php版本都是由brew安裝
一、使用brew安裝php多版本方法
|
1
2
|
# brew install php56
# brew install php70
|
二、安裝切換工具
|
1
2
|
# brew install php-version
# source $(brew --prefix php-version)/php-version.sh
|
三、查看當前安裝的所有版本
|
1
|
# php-version
|
四、切換版本
|
1
|
# php-version 5.6.5
|
mac下安裝php-version報錯
mac下安裝php-version報錯
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
rust
Error: No available formula with the name “php-version”
==> Searching for a previously deleted formula (in the last month)…
Error: No previously deleted formula found.
==> Searching for similarly named formulae…
Error: No similarly named formulae found.
==> Searching taps…
==> Searching taps on GitHub…
Error: No formulae found in taps.
試了很多方法,更新了brew 最后通過brew還是無法安裝成功。直接從git上clone下來使用了。
https://github.com/wilmoore/php-version/wiki/Troubleshooting#gathering-debug-info
- 進入你要放置php-version的目錄。
- git clone https://github.com/wilmoore/php-version.git
- source php-version/php-version.sh
- php-version 完成
測試:
作者:dayello

