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切り替えできるようにしたいなぁ...