安装
brew
^1/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ubuntu 可以 安装 linuxbrew ^3
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" PATH="$HOME/.linuxbrew/bin:$PATH"
安装php
$ brew install php56
可以通过 brew install 命令安装 php53、php54、php55、php56、php70或者 php71
安装
brew-php-switcher
^2linuxbrew, 可能需要使用
$ brew install homebrew/php/brew-php-switcher
进行安装$ brew install brew-php-switcher 1 ↵ Updating Homebrew... Error: No available formula with the name "brew-php-switcher" ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... This formula was found in a tap: homebrew/php/brew-php-switcher To install it, run: brew install homebrew/php/brew-php-switcher $ brew install homebrew/php/brew-php-switcher 127 ↵ Updating Homebrew... ==> Tapping homebrew/php 正克隆到 '/home/itaken/.linuxbrew/Library/Taps/homebrew/homebrew-php'... remote: Counting objects: 694, done. remote: Compressing objects: 100% (476/476), done. remote: Total 694 (delta 455), reused 294 (delta 213), pack-reused 0 接收对象中: 100% (694/694), 285.30 KiB | 113.00 KiB/s, 完成. 处理 delta 中: 100% (455/455), 完成. 检查连接... 完成。 Tapped 664 formulae (708 files, 1.4MB) ==> Installing brew-php-switcher from homebrew/php ==> Downloading https://github.com/philcook/brew-php-switcher/archive/1.6.tar.gz ==> Downloading from https://codeload.github.com/philcook/brew-php-switcher/tar. ######################################################################## 100.0% ==> Caveats To run brew php switcher do the following: "brew-php-switcher 53". You can select php version 53, 54, 55, 56, 70 or 71. ==> Summary 🍺 /home/itaken/.linuxbrew/Cellar/brew-php-switcher/1.6: 7 files, 23.6KB, built in 18 seconds
切换版本
$ brew-php-switcher 56
需要更新brew
$ brew install brew-php-switcher
Error: No available formula with the name "brew-php-switcher"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
This formula was found in a tap:
homebrew/php/brew-php-switcher
To install it, run:
brew install homebrew/php/brew-php-switcher
==> You haven't updated Homebrew in a while.
A formula for brew-php-switcher might have been added recently.
Run `brew update` to get the latest Homebrew updates!
$ brew update
remote: Counting objects: 1009, done.
...