環境
- macOS Sierra Version 10.12.4
- phpenv v0.0.4-dev
インストールする
$ anyenv install phpenv
$ exec $SHELL -l
$ phpenv install 7.1.4
エラー1
$ phpenv install 7.1.4
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: Loaded zendopcache Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.1.4 into ~/.anyenv/envs/phpenv/versions/7.1.4
[Downloading]: https://secure.php.net/distributions/php-7.1.4.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.1.4
-----------------
| BUILD ERROR |
-----------------
Here are the last 10 lines from the log:
-----------------------------------------
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: Cannot find OpenSSL's <evp.h>
-----------------------------------------
The full Log is available at '/tmp/php-build.7.1.4.20170504125133.log'.
[Warn]: Aborting build.
OpenSSLやmcryptをインストールする
$ brew install bison@2.7
$ brew link bison@2.7 --force
$ brew install re2c
$ brew install openssl
$ brew install libxml2
$ brew link --force openssl
$ brew link --force libxml2
$ brew install mcrypt
適宜exec $SHELL -l
実施
PHP7系のインストール成功
$ phpenv install 7.1.4
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: Loaded zendopcache Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.1.4 into ~/.anyenv/envs/phpenv/versions/7.1.4
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.1.4.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.1.4
[Compiling]: /var/tmp/php-build/source/7.1.4
[xdebug]: Installing version 2.5.2
[xdebug]: Compiling xdebug in /var/tmp/php-build/source/xdebug-2.5.2
[xdebug]: Installing xdebug configuration in ~/.anyenv/envs/phpenv/versions/7.1.4/etc/conf.d/xdebug.ini
[xdebug]: Cleaning up.
[Info]: Enabling Opcache...
[Info]: Done
[Info]: The Log File is not empty, but the Build did not fail. Maybe just warnings got logged. You can review the log in /tmp/php-build.7.1.4.20170425234957.log
[Success]: Built 7.1.4 successfully.
確認
$ php --version
PHP 5.6.30 (cli) (built: Feb 7 2017 16:06:52)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
$ exec $SHELL -l
$ phpenv global 7.1.4
7.1.4
$ php --version
PHP 7.1.4 (cli) (built: Apr 26 2017 00:05:20) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.4, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.2, Copyright (c) 2002-2017, by Derick Rethans
Composerもちゃんと
$ which composer
~/.anyenv/envs/phpenv/shims/composer
$ composer --version
Download composer.phar ...
All settings correct for using Composer
Downloading...
Composer (version 1.4.1) successfully installed to: ~/composer.phar
Use it: php ./composer.phar
Move composer.phar to ~/.anyenv/envs/phpenv/versions/7.1.4/composer
Composer version 1.4.1 2017-03-10 09:29:45