LoginSignup
8
4

More than 5 years have passed since last update.

macOS, OSX 上の phpenv で "configure: error: OpenSSL version 1.0.1 or greater required." とかで error となった時の対処方法

Posted at

久しぶりに phpenv で任意のバージョンをインストールしようとしたら "configure: error: OpenSSL version 1.0.1 or greater required." で error となった。

もう何番煎じなのかわからんぐらいにみんな書いてるけど…

対象方法をメモ。

前提

OSX, brew から openssl 入れてる

※多分 macOS でも同じはず。

結論

以下のように PHP_BUILD_CONFIGURE_OPTS を用いて、パラメーターを追加してやりましょう。

$ PHP_BUILD_CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" phpenv install 7.1.8

※多分、その他の依存でも同じようにパラメーターを追加することで解決するやつがあると思うけど、取り敢えず略。

起きた状況

おもむろに $ phpenv install 7.1.8 って叩いたら、 configure: error: OpenSSL version 1.0.1 or greater required. でビルドが止まった。

openssl は以前に brew からインストールした記憶があるので確認。

$ brew list openssl
/usr/local/Cellar/openssl/1.0.2l/.bottle/etc/ (8 files)
/usr/local/Cellar/openssl/1.0.2l/bin/c_rehash
/usr/local/Cellar/openssl/1.0.2l/bin/openssl
/usr/local/Cellar/openssl/1.0.2l/include/openssl/ (75 files)
/usr/local/Cellar/openssl/1.0.2l/lib/libcrypto.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2l/lib/libssl.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2l/lib/engines/ (12 files)
/usr/local/Cellar/openssl/1.0.2l/lib/pkgconfig/ (3 files)
/usr/local/Cellar/openssl/1.0.2l/lib/ (4 other files)
/usr/local/Cellar/openssl/1.0.2l/share/man/ (1597 files)

1.0.2l が入ってる。

が、ビルドエラー。

なので、 $ brew link openssl を試みた。

$ brew link openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

link 出来ないんですって。

なので、コンパイラにパスを教えてねって。

.bash_profile とかで PATH の優先順を変える方法もあるけど、なんか嫌。

というわけで、前述の PHP_BUILD_CONFIGURE_OPTS を用いた。

というメモ。

8
4
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
8
4