1
7

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.

macにphp7.3をインストール

Posted at

環境

macOS Mojave 10.14.6

PHP7.3インストール

現状確認

$ php -v
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )

$ brew search php@7
==> Formulae
php@7.1 php@7.2 php@7.3

インストール

brew install php@7.3

後処理

インストール時にパスを通してね、環境変数入れてね、みたいなワーニングが出ます。
以下、一例

If you need to have libpq first in your PATH run:
  echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile

For compilers to find libpq you may need to set:
  export LDFLAGS="-L/usr/local/opt/libpq/lib"
  export CPPFLAGS="-I/usr/local/opt/libpq/include"

For pkg-config to find libpq you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"

その指定に従って以下を実行。

$ echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile
$ vim ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile
$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
$ echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/openldap/bin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/openldap/sbin:$PATH"' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/curl-openssl/bin:$PATH"' >> ~/.bash_profile
$ export PKG_CONFIG_PATH="/usr/local/opt/curl-openssl/lib/pkgconfig"
$ echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
$ export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
$ echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile
$ export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"
$ echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
$ export PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"
$ brew services start php

結果

あれ!!バージョン変わってない!!

$ php -v
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

ターミナルの再起動したら解決

$ php -v
PHP 7.3.9 (cli) (built: Sep 14 2019 18:07:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.9, Copyright (c) 1999-2018, by Zend Technologies

文献

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?