Brew の準備
HomeBrew のインストールは済んでいることが前提。
PHPは homebrew/homebrew-php
でインストール。
> brew tap homebrew/homebrew-php
> brew install php70 && brew unlink php70
> brew install php56 && brew unlink php56
> brew install php71 && brew unlink php71
switch
PHPのバージョンを変更するのに、brew unlink php56 && brew link php71
はめんどいので php-switcher
をインストール。
~ $ brew install brew-php-switcher
==> Installing brew-php-switcher from homebrew/php
==> Downloading https://homebrew.bintray.com/bottles-php/brew-php-switcher-1.6.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring brew-php-switcher-1.6.sierra.bottle.tar.gz
==> 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
🍺 /usr/local/Cellar/brew-php-switcher/1.6: 7 files, 8.2KB
あとはこんな感じ
~ $ brew-php-switcher 70
Switching to php70
Switching your shell
Unlinking /usr/local/Cellar/php56/5.6.32_8... 0 symlinks removed
Unlinking /usr/local/Cellar/php70/7.0.22_14... 0 symlinks removed
Unlinking /usr/local/Cellar/php71/7.1.11_22... 17 symlinks removed
Linking /usr/local/Cellar/php70/7.0.22_14... 17 symlinks created
You will need sudo power from now on
Switching your apache conf
Password:
Sorry, try again.
Password:
Restarting apache
All done!