LoginSignup
0
0

More than 1 year has passed since last update.

PHPバージョンを切り替える

Posted at

phpのバージョンを更新したくて、homebrewでphpをインストールして、今まで使っていた7.3から8に切り替える。

シンボリックリンクの張り替え
※ここら辺は色々やったのでどのコマンドで反映されたかわからない

$ brew unlink php@7.3 && brew link --force php
$ brew unlink php && brew link php

.bash_profileからphp@7.3のパスを削除(コメントアウト)

# export PATH="/usr/local/opt/php@7.3/bin:$PATH"
# export PATH="/usr/local/opt/php@7.3/sbin:$PATH"

.bash_profileを反映

$ source ~/.bash_profile

まだパスにphp@7.3が残っているので、最終的に使ってるターミナル(iterm)を再起動する。

$ php -v
PHP 8.0.0 (cli) (built: Nov 30 2020 13:43:08) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

無事にphp 8.0が使えるようになった。

参考:

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