Help us understand the problem. What is going on with this article?

PHP7.1とphp7.0とphp5.6とphp5.5をMac上で同居させる

More than 3 years have passed since last update.

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!
mohikanz
エンジニアのための雑談コミュニティ
https://mohikanz.slack.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away