もがき系プログラマの日常

もがき系エンジニアの勉強したこと、日常のこと、気になっている技術、備忘録などを紹介するブログです。

phpenvでphp8をMacにインストール

はじめに

以下の本で紹介されている psalm を試すために php8をインストールしました。 なんか変なところにつまったので、一旦備忘録残しておきます。

参考サイト

anyenv + phpenvでPHP8をインストールした作業メモ

本題

まずは必要なライブラリをbrewで入れます。

$ brew install pkg-config bzip2 libjpeg libiconv tidy-html5 libzip autoconf

これでOKっぽいので、以下のコマンドでinstallします。

$ PHP_BUILD_CONFIGURE_OPTS="--with-bz2=/usr/local/opt/bzip2 --with-iconv=/usr/local/opt/libiconv" phpenv install 8.0.9

[Preparing]: /var/tmp/php-build/source/8.0.9
[Compiling]: /var/tmp/php-build/source/8.0.9

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

Here are the last 10 lines from the log:

-----------------------------------------
/var/tmp/php-build/source/8.0.9/ext/openssl/openssl.c:6393:6: warning: passing 'const struct rsa_st *' to parameter of type 'RSA *' (aka 'struct rsa_st *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                                        EVP_PKEY_get0_RSA(pkey),
                                        ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/openssl@3/3.0.0_1/include/openssl/rsa.h:289:29: note: passing argument to parameter 'rsa' here
                       RSA *rsa, int padding);
                            ^
108 warnings and 1 error generated.
make: *** [ext/openssl/openssl.lo] Error 1
make: *** Waiting for unfinished jobs....
3 warnings generated.
-----------------------------------------

opensslで系でなんかエラーが出ました。

brew list してみると、 openssl@1.1 openssl@3 がありました。

そういえば、以前の記事で openssl@3がインストールしたのですが、それが原因なのかもしれません。。。

kojirooooocks.hatenablog.com

これがだめなのかな...?

なので、一旦 openssl@3 をアンインストールしてみます。

brew uninstall openssl@3

ただし、これだけだとまだ上記のエラーが発生していました。

続けて以下の記事を試しました。

qiita.com

これできれいにインストールすることができました!

無駄にハマったー。