LoginSignup
2
3

More than 5 years have passed since last update.

phpenvでPHPをインストールする。

Posted at

環境

  • MacBook Pro (13-inch, Late 2016, Two Thunderbolt 3 ports)
  • macOS Sierra (10.12.1)
  • anyenvでphpenv導入済み

ビルドエラー

インストールを行う際、以下のエラーでインストールができませんでした。以下の手順で解消しました。

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

Here are the last 10 lines from the log:

-----------------------------------------
                 int (* _Nullable)(void *));
                                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/stdio.h:475:6: warning: pointer is missing a nullability type specif
ier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
FILE    *funopen(const void *,
        ^
/var/folders/tq/0b16gfr93wg2042hvph16nl40000gn/T/php-build/source/5.6.28/ext/openssl/openssl.c:44:10: fatal error: 'openssl/evp.h' file not found
#include <openssl/evp.h>
         ^
324 warnings and 1 error generated.
make: *** [ext/openssl/openssl.lo] Error 1
-----------------------------------------

解決手順

  • xcode commandline Toolsをインストール
  • opensslをインストールする
$ brew install homebrew/versions/openssl101
  • libxml2をインストールする
$ brew install libxml2
  • リンクを更新するもうまく行かず
$ brew link --force homebrew/versions/openssl101
$ brew link --force libxml2
  • オプションを指定してインストールする
$ PHP_BULID_CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl) --with-libxml=$(brew --prefix libxml2)" phpenv install [install_version]

これでなんとかコンパイル時に発生するエラーを回避して、インストールができました。

参考URL

2
3
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
2
3