LoginSignup
0
0

More than 3 years have passed since last update.

HomebrewでPHP7.2のインストール(Mac)

Last updated at Posted at 2019-10-01

install php for mac

mac OS version : 10.14.4
Homebrew : 2.1.9

参考1 : https://qiita.com/saken649/items/b5830de62211b600f7ee
参考2 : https://qiita.com/nemui_/items/cbf876db509e6a427541

homebrewはインストールしてあることが前提

phpのデフォルトバージョン確認

$ php -v
PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
$ brew search php72
==> Formulae
php@7.2

$ brew install php@7.2
(前略)
If you need to have php@7.2 first in your PATH run:
  echo 'set -g fish_user_paths "/usr/local/opt/php@7.2/bin" $fish_user_paths' >> ~/.config/fish/config.fish
  echo 'set -g fish_user_paths "/usr/local/opt/php@7.2/sbin" $fish_user_paths' >> ~/.config/fish/config.fish
(後略)

pathを通す(おらのシェルはfishなので,bashとは少しコマンドが違う)

$ echo 'set -g fish_user_paths "/usr/local/opt/php@7.2/bin" $fish_user_paths' >> ~/.config/fish/config.fish
$ echo 'set -g fish_user_paths "/usr/local/opt/php@7.2/sbin" $fish_user_paths' >> ~/.config/fish/config.fish

再読み込みして通るか確認

$ source ~/.config/fish/config.fish
$ which php
/usr/local/opt/php@7.2/bin/php

$ php -v
PHP 7.2.22 (cli) (built: Sep 14 2019 18:36:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.22, Copyright (c) 1999-2018, by Zend Technologies

インストール完了.
rbenvみたいにversion切り替えできるようにしたいなぁ...

0
0
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
0
0