3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-11-24

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!
3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?