PHPのbuild時にopenSSLが存在しないとエラーが出る時の対処法
表題の通り、PHPをコードからbuildする時にopenSSLが存在しないためconfigureが上手く行かない時の対処法
起きていること
./configure --prefix=$PWD/bin --enable-debug --with-openssl=/usr/bin/openssl --enable-mbstring
--with-openssl
のオプションにディレクトリを指定してあげると、以下のエラーが発生する。
configure: error: Cannot find OpenSSL's <evp.h>
対処法
公式やGitHubのissueをチェックすると、「そもそもpkg-config
が存在しないのがダメなのでは?」と考える。
https://bugs.php.net/bug.php?id=77392
しかし、期待した通りに上手く行かない。
--with-opensslのオプションを変更する
今までは以下のようにオプションを付与していたが、
./configure --prefix=$PWD/bin --enable-debug --with-openssl=/usr/bin/openssl --enable-mbstring
これを下記のように変更する
./configure --prefix=$PWD/bin --enable-debug --with-openssl --enable-mbstring
これで上手くいった
なぜ--with-openssl=/usr/local/opensslだと上手くいかなかったのか?
そもそも、なぜconfigureはincludeファイルを見つけることができなかったのか?
compiling - How to add libraries path to the ./configure command? - Ask Ubuntu
ココらへんにヒントがありそう