PHP

php7.1をmacOS Sierra 10.12にインストールする


すでにインストールされてphpを確認する

<コンピューター名>:~ <ユーザー名>$ php -v

PHP 5.6.24 (cli) (built: Aug 8 2016 16:58:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies


Homebrewでphp7.1を探す

<コンピューター名>:~ <ユーザー名>$ brew search php@7.1

==> Formulae
php@7.1 homebrew/linuxbrew-core/php@7.1


Homebrewでphp7.1をインストール

<コンピューター名>:~ <ユーザー名>$ brew install php@7.1

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
glooctl

==> Installing dependencies for php@7.1: aspell, libidn, libmetalink, libssh2, openldap, rtmpdump, curl-openssl, libtool, unixodbc, freetds, libpng, freetype, gettext, libffi, gdbm, sqlite, xz, python, glib, gmp, jpeg, libpq, libzip, mhash, mcrypt, tidy-html5, libtiff, webp
==> Installing php@7.1 dependency: aspell
==> Downloading https://homebrew.bintray.com/bottles/aspell-0.60.6.1_1.sierra.bo
######################################################################## 100.0%
==> Pouring aspell-0.60.6.1_1.sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/aspell/0.60.6.1_1: 758 files, 314.9MB
==> Installing php@7.1 dependency: libidn
==> Downloading https://homebrew.bintray.com/bottles/libidn-1.35.sierra.bottle.t
######################################################################## 100.0%
==> Pouring libidn-1.35.sierra.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/libidn
==> Summary
🍺 /usr/local/Cellar/libidn/1.35: 72 files, 1.4MB
==> Installing php@7.1 dependency: libmetalink
==> Downloading https://homebrew.bintray.com/bottles/libmetalink-0.1.3.sierra.bo
######################################################################## 100.0%
==> Pouring libmetalink-0.1.3.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libmetalink/0.1.3: 30 files, 178.4KB
==> Installing php@7.1 dependency: libssh2
==> Downloading https://homebrew.bintray.com/bottles/libssh2-1.8.2.sierra.bottle
######################################################################## 100.0%
==> Pouring libssh2-1.8.2.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libssh2/1.8.2: 182 files, 802.2KB
==> Installing php@7.1 dependency: openldap
==> Downloading https://homebrew.bintray.com/bottles/openldap-2.4.47.sierra.bott
######################################################################## 100.0%
==> Pouring openldap-2.4.47.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openldap/lib
CPPFLAGS: -I/usr/local/opt/openldap/include

==> Summary
🍺 /usr/local/Cellar/openldap/2.4.47: 327 files, 6.6MB
==> Installing php@7.1 dependency: rtmpdump
==> Downloading https://homebrew.bintray.com/bottles/rtmpdump-2.4+20151223.sierr
######################################################################## 100.0%
==> Pouring rtmpdump-2.4+20151223.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/rtmpdump/2.4+20151223: 19 files, 422.2KB
==> Installing php@7.1 dependency: curl-openssl
==> Downloading https://homebrew.bintray.com/bottles/curl-openssl-7.64.1.sierra.
######################################################################## 100.0%
==> Pouring curl-openssl-7.64.1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/curl-openssl/lib
CPPFLAGS: -I/usr/local/opt/curl-openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/curl-openssl/lib/pkgconfig

==> Summary
🍺 /usr/local/Cellar/curl-openssl/7.64.1: 450 files, 3.5MB
==> Installing php@7.1 dependency: libtool
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bott
######################################################################## 100.0%
==> Pouring libtool-2.4.6_1.sierra.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺 /usr/local/Cellar/libtool/2.4.6_1: 70 files, 3.7MB
==> Installing php@7.1 dependency: unixodbc
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.7.sierra.bottl
######################################################################## 100.0%
==> Pouring unixodbc-2.3.7.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/unixodbc/2.3.7: 46 files, 1.8MB
==> Installing php@7.1 dependency: freetds
==> Downloading https://homebrew.bintray.com/bottles/freetds-1.1.5.sierra.bottle
######################################################################## 100.0%
==> Pouring freetds-1.1.5.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/freetds/1.1.5: 2,141 files, 13.1MB
==> Installing php@7.1 dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.37.sierra.bottle
######################################################################## 100.0%
==> Pouring libpng-1.6.37.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libpng/1.6.37: 27 files, 1.2MB
==> Installing php@7.1 dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.10.0.sierra.bott
######################################################################## 100.0%
==> Pouring freetype-2.10.0.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/freetype/2.10.0: 61 files, 2.3MB
==> Installing php@7.1 dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.sierra.bot
######################################################################## 100.0%
==> Pouring gettext-0.19.8.1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/gettext/lib
CPPFLAGS: -I/usr/local/opt/gettext/include

==> Summary
🍺 /usr/local/Cellar/gettext/0.19.8.1: 1,934 files, 16.9MB
==> Installing php@7.1 dependency: libffi
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.2.1.sierra.bottle.
######################################################################## 100.0%
==> Pouring libffi-3.2.1.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libffi/lib
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/libffi/lib/pkgconfig

==> Summary
🍺 /usr/local/Cellar/libffi/3.2.1: 16 files, 297.0KB
==> Installing php@7.1 dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.sierra.bottle.1
######################################################################## 100.0%
==> Pouring gdbm-1.18.1.sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/gdbm/1.18.1: 20 files, 586.8KB
==> Installing php@7.1 dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.28.0.sierra.bottle
######################################################################## 100.0%
==> Pouring sqlite-3.28.0.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig

==> Summary
🍺 /usr/local/Cellar/sqlite/3.28.0: 11 files, 3.7MB
==> Installing php@7.1 dependency: xz
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.4.sierra.bottle.tar.
######################################################################## 100.0%
==> Pouring xz-5.2.4.sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/lzcat
Target /usr/local/bin/lzcat
is a symlink belonging to xz. You can unlink it:
brew unlink xz

To force the link and overwrite all conflicting files:
brew link --overwrite xz

To list all files that would be deleted:
brew link --overwrite --dry-run xz

Possible conflicting files are:
/usr/local/bin/lzcat -> /usr/local/Cellar/xz/5.2.1/bin/lzcat
/usr/local/bin/lzcmp -> /usr/local/Cellar/xz/5.2.1/bin/lzcmp
/usr/local/bin/lzdiff -> /usr/local/Cellar/xz/5.2.1/bin/lzdiff
/usr/local/bin/lzegrep -> /usr/local/Cellar/xz/5.2.1/bin/lzegrep
/usr/local/bin/lzfgrep -> /usr/local/Cellar/xz/5.2.1/bin/lzfgrep
/usr/local/bin/lzgrep -> /usr/local/Cellar/xz/5.2.1/bin/lzgrep
/usr/local/bin/lzless -> /usr/local/Cellar/xz/5.2.1/bin/lzless
/usr/local/bin/lzma -> /usr/local/Cellar/xz/5.2.1/bin/lzma
/usr/local/bin/lzmadec -> /usr/local/Cellar/xz/5.2.1/bin/lzmadec
/usr/local/bin/lzmainfo -> /usr/local/Cellar/xz/5.2.1/bin/lzmainfo
/usr/local/bin/lzmore -> /usr/local/Cellar/xz/5.2.1/bin/lzmore
/usr/local/bin/unlzma -> /usr/local/Cellar/xz/5.2.1/bin/unlzma
/usr/local/bin/unxz -> /usr/local/Cellar/xz/5.2.1/bin/unxz
/usr/local/bin/xz -> /usr/local/Cellar/xz/5.2.1/bin/xz
/usr/local/bin/xzcat -> /usr/local/Cellar/xz/5.2.1/bin/xzcat
/usr/local/bin/xzcmp -> /usr/local/Cellar/xz/5.2.1/bin/xzcmp
/usr/local/bin/xzdec -> /usr/local/Cellar/xz/5.2.1/bin/xzdec
/usr/local/bin/xzdiff -> /usr/local/Cellar/xz/5.2.1/bin/xzdiff
/usr/local/bin/xzegrep -> /usr/local/Cellar/xz/5.2.1/bin/xzegrep
/usr/local/bin/xzfgrep -> /usr/local/Cellar/xz/5.2.1/bin/xzfgrep
/usr/local/bin/xzgrep -> /usr/local/Cellar/xz/5.2.1/bin/xzgrep
/usr/local/bin/xzless -> /usr/local/Cellar/xz/5.2.1/bin/xzless
/usr/local/bin/xzmore -> /usr/local/Cellar/xz/5.2.1/bin/xzmore
/usr/local/include/lzma/base.h
/usr/local/include/lzma/bcj.h
/usr/local/include/lzma/block.h
/usr/local/include/lzma/check.h
/usr/local/include/lzma/container.h
/usr/local/include/lzma/delta.h
/usr/local/include/lzma/filter.h
/usr/local/include/lzma/hardware.h
/usr/local/include/lzma/index.h
/usr/local/include/lzma/index_hash.h
/usr/local/include/lzma/lzma12.h
/usr/local/include/lzma/stream_flags.h
/usr/local/include/lzma/version.h
/usr/local/include/lzma/vli.h
/usr/local/include/lzma/base.h
/usr/local/include/lzma/bcj.h
/usr/local/include/lzma/block.h
/usr/local/include/lzma/check.h
/usr/local/include/lzma/container.h
/usr/local/include/lzma/delta.h
/usr/local/include/lzma/filter.h
/usr/local/include/lzma/hardware.h
/usr/local/include/lzma/index.h
/usr/local/include/lzma/index_hash.h
/usr/local/include/lzma/lzma12.h
/usr/local/include/lzma/stream_flags.h
/usr/local/include/lzma/version.h
/usr/local/include/lzma/vli.h
/usr/local/include/lzma.h -> /usr/local/Cellar/xz/5.2.1/include/lzma.h
/usr/local/share/doc/xz/AUTHORS
/usr/local/share/doc/xz/COPYING
/usr/local/share/doc/xz/COPYING.GPLv2
/usr/local/share/doc/xz/NEWS
/usr/local/share/doc/xz/README
/usr/local/share/doc/xz/THANKS
/usr/local/share/doc/xz/TODO
/usr/local/share/doc/xz/examples/00_README.txt
/usr/local/share/doc/xz/examples/01_compress_easy.c
/usr/local/share/doc/xz/examples/02_decompress.c
/usr/local/share/doc/xz/examples/03_compress_custom.c
/usr/local/share/doc/xz/examples/04_compress_easy_mt.c
/usr/local/share/doc/xz/examples/Makefile
/usr/local/share/doc/xz/examples_old/xz_pipe_comp.c
/usr/local/share/doc/xz/examples_old/xz_pipe_decomp.c
/usr/local/share/doc/xz/faq.txt
/usr/local/share/doc/xz/history.txt
/usr/local/share/doc/xz/lzma-file-format.txt
/usr/local/share/doc/xz/xz-file-format.txt
/usr/local/share/doc/xz/AUTHORS
/usr/local/share/doc/xz/COPYING
/usr/local/share/doc/xz/COPYING.GPLv2
/usr/local/share/doc/xz/NEWS
/usr/local/share/doc/xz/README
/usr/local/share/doc/xz/THANKS
/usr/local/share/doc/xz/TODO
/usr/local/share/doc/xz/examples/00_README.txt
/usr/local/share/doc/xz/examples/01_compress_easy.c
/usr/local/share/doc/xz/examples/02_decompress.c
/usr/local/share/doc/xz/examples/03_compress_custom.c
/usr/local/share/doc/xz/examples/04_compress_easy_mt.c
/usr/local/share/doc/xz/examples/Makefile
/usr/local/share/doc/xz/examples_old/xz_pipe_comp.c
/usr/local/share/doc/xz/examples_old/xz_pipe_decomp.c
/usr/local/share/doc/xz/faq.txt
/usr/local/share/doc/xz/history.txt
/usr/local/share/doc/xz/lzma-file-format.txt
/usr/local/share/doc/xz/xz-file-format.txt
/usr/local/share/man/man1/lzcat.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzcat.1
/usr/local/share/man/man1/lzcmp.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzcmp.1
/usr/local/share/man/man1/lzdiff.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzdiff.1
/usr/local/share/man/man1/lzegrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzegrep.1
/usr/local/share/man/man1/lzfgrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzfgrep.1
/usr/local/share/man/man1/lzgrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzgrep.1
/usr/local/share/man/man1/lzless.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzless.1
/usr/local/share/man/man1/lzma.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzma.1
/usr/local/share/man/man1/lzmadec.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzmadec.1
/usr/local/share/man/man1/lzmainfo.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzmainfo.1
/usr/local/share/man/man1/lzmore.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/lzmore.1
/usr/local/share/man/man1/unlzma.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/unlzma.1
/usr/local/share/man/man1/unxz.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/unxz.1
/usr/local/share/man/man1/xz.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xz.1
/usr/local/share/man/man1/xzcat.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzcat.1
/usr/local/share/man/man1/xzcmp.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzcmp.1
/usr/local/share/man/man1/xzdec.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzdec.1
/usr/local/share/man/man1/xzdiff.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzdiff.1
/usr/local/share/man/man1/xzegrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzegrep.1
/usr/local/share/man/man1/xzfgrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzfgrep.1
/usr/local/share/man/man1/xzgrep.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzgrep.1
/usr/local/share/man/man1/xzless.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzless.1
/usr/local/share/man/man1/xzmore.1 -> /usr/local/Cellar/xz/5.2.1/share/man/man1/xzmore.1
/usr/local/lib/liblzma.5.dylib -> /usr/local/Cellar/xz/5.2.1/lib/liblzma.5.dylib
/usr/local/lib/liblzma.a -> /usr/local/Cellar/xz/5.2.1/lib/liblzma.a
/usr/local/lib/liblzma.dylib -> /usr/local/Cellar/xz/5.2.1/lib/liblzma.dylib
/usr/local/lib/pkgconfig/liblzma.pc -> /usr/local/Cellar/xz/5.2.1/lib/pkgconfig/liblzma.pc
==> Summary
🍺 /usr/local/Cellar/xz/5.2.4: 92 files, 1MB
==> Installing php@7.1 dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.3.sierra.bottle.
######################################################################## 100.0%
==> Pouring python-3.7.3.sierra.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
/usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
brew install python@2

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /usr/local/Cellar/python/3.7.3: 3,863 files, 59.8MB
==> Installing php@7.1 dependency: glib
==> Downloading https://homebrew.bintray.com/bottles/glib-2.60.2.sierra.bottle.t
######################################################################## 100.0%
==> Pouring glib-2.60.2.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/glib/2.60.2: 429 files, 15.2MB
==> Installing php@7.1 dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2_2.sierra.bottle.1
######################################################################## 100.0%
==> Pouring gmp-6.1.2_2.sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3.1MB
==> Installing php@7.1 dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.sierra.bottle.tar.g
######################################################################## 100.0%
==> Pouring jpeg-9c.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/jpeg/9c: 21 files, 724.6KB
==> Installing php@7.1 dependency: libpq
==> Downloading https://homebrew.bintray.com/bottles/libpq-11.2.sierra.bottle.ta
######################################################################## 100.0%
==> Pouring libpq-11.2.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libpq/lib
CPPFLAGS: -I/usr/local/opt/libpq/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/libpq/lib/pkgconfig

==> Summary
🍺 /usr/local/Cellar/libpq/11.2: 2,204 files, 22.4MB
==> Installing php@7.1 dependency: libzip
==> Downloading https://homebrew.bintray.com/bottles/libzip-1.5.2.sierra.bottle.
######################################################################## 100.0%
==> Pouring libzip-1.5.2.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libzip/1.5.2: 134 files, 579.9KB
==> Installing php@7.1 dependency: mhash
==> Downloading https://homebrew.bintray.com/bottles/mhash-0.9.9.9.sierra.bottle
######################################################################## 100.0%
==> Pouring mhash-0.9.9.9.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/mhash/0.9.9.9: 19 files, 453.3KB
==> Installing php@7.1 dependency: mcrypt
==> Downloading https://homebrew.bintray.com/bottles/mcrypt-2.6.8.sierra.bottle.
######################################################################## 100.0%
==> Pouring mcrypt-2.6.8.sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/mcrypt/2.6.8: 18 files, 380.9KB
==> Installing php@7.1 dependency: tidy-html5
==> Downloading https://homebrew.bintray.com/bottles/tidy-html5-5.6.0.sierra.bot
######################################################################## 100.0%
==> Pouring tidy-html5-5.6.0.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/tidy-html5/5.6.0: 14 files, 2.6MB
==> Installing php@7.1 dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.10_1.sierra.bot
######################################################################## 100.0%
==> Pouring libtiff-4.0.10_1.sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libtiff/4.0.10_1: 246 files, 3.5MB
==> Installing php@7.1 dependency: webp
==> Downloading https://homebrew.bintray.com/bottles/webp-1.0.2.sierra.bottle.1.
######################################################################## 100.0%
==> Pouring webp-1.0.2.sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/webp/1.0.2: 39 files, 2.1MB
==> Installing php@7.1
==> Downloading https://homebrew.bintray.com/bottles/php@7.1-7.1.29.sierra.bottl
######################################################################## 100.0%
==> Pouring php@7.1-7.1.29.sierra.bottle.tar.gz
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set php_ini /usr/local/etc/
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set php_dir /usr/local/shar
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set doc_dir /usr/local/shar
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set ext_dir /usr/local/lib/
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set bin_dir /usr/local/opt/
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set data_dir /usr/local/sha
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set cfg_dir /usr/local/shar
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set www_dir /usr/local/shar
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set man_dir /usr/local/shar
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set test_dir /usr/local/sha
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear config-set php_bin /usr/local/opt/
==> /usr/local/Cellar/php@7.1/7.1.29/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/php@7.1/lib
CPPFLAGS: -I/usr/local/opt/php@7.1/include

To have launchd start php@7.1 now and restart at login:
brew services start php@7.1
Or, if you don't want/need a background service you can just run:
php-fpm
==> Summary
🍺 /usr/local/Cellar/php@7.1/7.1.29: 513 files, 63MB
==> Caveats
==> libidn
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/libidn
==> openldap
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openldap/lib
CPPFLAGS: -I/usr/local/opt/openldap/include

==> curl-openssl
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/curl-openssl/lib
CPPFLAGS: -I/usr/local/opt/curl-openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/curl-openssl/lib/pkgconfig

==> libtool
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> gettext
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/gettext/lib
CPPFLAGS: -I/usr/local/opt/gettext/include

==> libffi
This formula is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libffi/lib
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/libffi/lib/pkgconfig

==> sqlite
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig

==> python
Python has been installed as
/usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin

If you need Homebrew's Python 2.7 run
brew install python@2

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> libpq
This formula is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.

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

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/libpq/lib
CPPFLAGS: -I/usr/local/opt/libpq/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/libpq/lib/pkgconfig

==> php@7.1
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/

This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/php@7.1/lib
CPPFLAGS: -I/usr/local/opt/php@7.1/include

To have launchd start php@7.1 now and restart at login:
brew services start php@7.1
Or, if you don't want/need a background service you can just run:
php-fpm


phpのバージョンを確認すると5.6.24となりHomebrewでインストールしたものではないのがわかる

<コンピューター名>:~ <ユーザー名>$ php -v

PHP 5.6.24 (cli) (built: Aug 8 2016 16:58:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies


インストール途中に記述されていたパスを通す為の記述を入力する

<コンピューター名>:~ <ユーザー名>$ echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile

<コンピューター名>:~ <ユーザー名>$ echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile


.bash_profileを開いて反映された内容を確認する

<コンピューター名>:~ <ユーザー名>$ open ~/.bash_profile

export PATH="/usr/local/Cellar/git/2.14.1/bin/git:$PATH"

if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
export PATH="/usr/local/opt/php@7.1/bin:$PATH"
export PATH="/usr/local/opt/php@7.1/sbin:$PATH"


.bash_profileを実行する

<コンピューター名>:~ <ユーザー名>$ source ~/.bash_profile


phpのバージョンを確認するとHomebrewでインストールされたバージョン7.1.29のphpであることがわかります

<コンピューター名>:~ <ユーザー名>$ php -v

PHP 7.1.29 (cli) (built: May 3 2019 07:56:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.29, Copyright (c) 1999-2018, by Zend Technologies


参考

https://weblabo.oscasierra.net/php-71-mac-homebrew-install/

https://qiita.com/soarflat/items/09be6ab9cd91d366bf71