LoginSignup
28
20

More than 5 years have passed since last update.

macでphpenvとphp-buildでPHP環境を作るときに入れた依存パッケージ

Last updated at Posted at 2017-06-16

新しいmacを買ってphpの環境を整えたときに思いのほかphpenvの環境を作るのに苦労したので残しておきます

phpenvのインストール

git clone https://github.com/CHH/phpenv.git
cd phpenv/bin
./phpenv-install.sh

~/.bashrcに以下記載

export PATH="/Users/uenoryouichi/.phpenv/bin:$PATH"
eval "$(phpenv init -)"

php-buildのインストール

git clone https://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build

【主題】phpenv install x.x.x で必要になったパッケージ

installのコマンドがコケる

phpenv install 7.1.6

-----------------
|  BUILD ERROR  |
-----------------

-----------------------------------------
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: 2.3, min: 204, excluded: ).
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: OpenSSL version 1.0.1 or greater required.
-----------------------------------------
とか
-----------------------------------------
configure: error: jpeglib.h not found.
-----------------------------------------
とか
-----------------------------------------
configure: error: png.h not found.
-----------------------------------------
# ネットからこれ入れておけ的パッケージ群
brew install gcc re2c libmcrypt autoconf automake libiconv

# bison
$ brew install bison
$ brew link --force bison

# openssl (libxmlも入れないといけないのでハマった)
$ brew install openssl
$ brew install libxml2
$ brew link --force openssl
$ brew link --force libxml2

# jpeg
$ brew install jpeg

# png
$ brew install libpng

# icu4c
$ brew instal icu4c
$ brew link --force icu4c

晴れてインストール

$ phpenv install 7.1.6
...
[Success]: Built 7.1.6 successfully.

$ phpenv versions
$ phpenv global 7.1.6
$ php -v
PHP 7.1.6 (cli) (built: Jun 17 2017 00:01:18) ( NTS )
28
20
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
28
20