とりあえずOpenSSL1.1系を使いたくないだけが理由。OpenSSL3.4系を基盤としたPHP環境を構築してみた。
手順は以下の通り。
dnf config-manager --set-enabled powertools
dnf install epel-release
dnf install libtool \
gcc-c++ \
gcc-toolset-11-gcc-c++
dnf install wget \
tar \
gcc \
make \
zlib \
zlib-devel \
expat \
expat-devel \
libtool \
pcre \
pcre-devel -y
dnf install readline \
readline-devel -y
dnf install autoconf \
libpsl \
libpsl-devel \
zlib \
zlib-devel \
libicu-devel \
gd \
gd-devel \
libpng \
libpng-devel \
freetype \
freetype-devel \
fontconfig \
fontconfig-devel \
libjpeg-turbo \
libjpeg-turbo-devel \
libXpm \
libXpm-devel \
libtiff \
libtiff-devel \
libxslt \
libxslt-devel \
re2c \
libxml2 \
libxml2-devel \
libwebp \
libwebp-devel \
oniguruma \
oniguruma-devel \
sqlite-devel
・OpenSSL3.4.1をインストール
dnf install wget \
tar \
gcc \
make \
zlib \
zlib-devel -y
dnf install perl-IPC-Cmd perl-Pod-Html -y
wget https://github.com/openssl/openssl/releases/download/openssl-3.4.1/openssl-3.4.1.tar.gz
tar xvfz openssl-3.4.1.tar.gz
cd openssl-3.4.1
LDFLAGS="-Wl,-rpath=/var/home/lib/openssl/lib64" \
./Configure --prefix=/var/home/lib/openssl shared zlib
make all
(約8分かかる)
make install_sw
make install_ssldirs
mv /var/home/lib/openssl /var/home/lib/openssl3.4.1
ln -s /var/home/lib/openssl3.4.1 /var/home/lib/openssl
・libzipのインストール
wget https://libzip.org/download/libzip-1.11.3.tar.gz
tar xvfz libzip-1.11.3.tar.gz
cd libzip-1.11.3
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/var/home/lib/libzip \
-DCMAKE_INSTALL_RPATH=/var/home/lib/openssl/lib64:/usr/lib:/usr/lib64 \
-DENABLE_OPENSSL=ON \
-DOPENSSL_ROOT_DIR=/var/home/lib/openssl \
-DOPENSSL_LIBRARIES=/var/home/lib/openssl/lib64
make
make install
cd /var/home/lib
mv libzip libzip1.11.3
ln -s libzip1.11.3 libzip
・ImageMagickのインストール
wget https://imagemagick.org/archive/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd ImageMagick-7.1.1-43
PKG_CONFIG_PATH=/var/home/lib/libzip/lib64/pkgconfig:/var/home/lib/openssl/lib64/pkgconfig:/usr/lib64/pkgconfig \
LDFLAGS="-Wl,-rpath=/var/home/lib/libzip/lib64:/usr/lib:/usr/lib64" \
./configure --prefix=/var/home/lib/imagic
make all
(約6分かかる)
make install
mkdir /var/home/lib/ImageMagick-7.1.1-43
ln -s /var/home/lib/ImageMagick-7.1.1-43 /var/home/lib/imagic
・libc-client.soのインストール
wget https://github.com/uw-imap/imap/archive/refs/tags/imap-2007f_upstream.tar.gz
wget https://raw.githubusercontent.com/openwrt/packages/master/libs/uw-imap/patches/010-imap-2007f-openssl-1.1.patch
tar xvfz imap-2007f_upstream.tar.gz
cd imap-imap-2007f_upstream/
patch -p1 < ../010-imap-2007f-openssl-1.1.patch
make lnp SSLTYPE=unix \
EXTRACFLAGS="-fPIC -I/var/home/lib/openssl/include -I/var/home/lib/openssl/include/openssl" \
EXTRALDFLAGS="-L/var/home/lib/openssl/lib64 -Wl,-rpath=/var/home/lib/openssl/lib64" \
SSLLIB=/var/home/lib/openssl/lib64
make lnp c-client
cd c-client
gcc `cat CFLAGS` `cat LDFLAGS` -shared -o libc-client.so.2007 ./*.o
mkdir /var/home/lib/c-client
mkdir /var/home/lib/c-client/lib64
mkdir /var/home/lib/c-client/include
cp *.h /var/home/lib/c-client/include
cp linkage.c /var/home/lib/c-client/include
cp libc-client.so.2007 /var/home/lib/c-client/lib64
cp c-client.a /var/home/lib/c-client/lib64
cd /var/home/lib/c-client/lib64
ln -s libc-client.so.2007 libc-client.so
・libssh2のインストール
wget https://libssh2.org/download/libssh2-1.11.1.tar.gz
tar xvfz libssh2-1.11.1.tar.gz
cd libssh2-1.11.1
CFLAGS="-I/var/home/lib/openssl/include -I/var/home/lib/openssl/include/openssl" \
LDFLAGS="-L/var/home/lib/openssl/lib64 -Wl,-rpath=/var/home/lib/openssl/lib64" \
./configure --prefix=/var/home/lib/libssh2 \
--with-openssl=/var/home/lib/openssl \
--with-libssl-prefix=/var/home/lib/openssl/include/openssl
make all
make install
cd /var/home/lib/
mv libssh2 libssh2-1.11.1
ln -s /var/home/lib/libssh2-1.11.1 libssh2
・CURLのインストール
wget https://curl.se/download/curl-8.12.1.tar.gz
tar xvfz curl-8.12.1.tar.gz
cd curl-8.12.1
PKG_CONFIG_PATH="/var/home/lib/openssl/lib64/pkgconfig" \
LIBS="-lssl -lcrypto" \
CPPFLAGS="-I/var/home/lib/openssl/include -I/var/home/lib/openssl/include/openssl" \
LDFLAGS="-L/var/home/lib/openssl/lib64 -Wl,-rpath=/var/home/lib/openssl/lib64" \
./configure --prefix=/var/home/lib/curl \
--enable-http \
--enable-ftp \
--enable-file \
--enable-proxy \
--enable-cookies \
--enable-ipv6 \
--with-zlib=/usr \
--with-libssh2=/var/home/lib/libssh2 \
--disable-openssl-auto-load-config \
--with-openssl=/var/home/lib/openssl
make all
make install
mkdir /var/home/lib/curl8.12.1
ln -s /var/home/lib/curl8.12.1 /var/home/lib/curl
・PHP8.3.21のインストール
wget https://www.php.net/distributions/php-8.3.21.tar.gz
tar xvfz php-8.3.21.tar.gz
cd php-8.3.21
PKG_CONFIG_PATH="/var/home/lib/libzip/lib64/pkgconfig:/var/home/lib/curl/lib/pkgconfig:/var/home/lib/libssh2/lib/pkgconfig:/var/home/lib/openssl/lib64/pkgconfig:/lib64/pkgconfig:/usr/lib64/pkgconfig" \
CFLAGS="-fPIE -I/var/home/lib/c-client/include -I/var/home/lib/openssl/include" \
LDFLAGS="-pie -L/var/home/lib/c-client/lib64 -Wl,-rpath=/var/home/lib/c-client/lib64 -L/var/home/lib/openssl/lib64 -Wl,-rpath=/var/home/lib/openssl/lib64" \
./configure --with-pic \
--prefix=/var/home/ap/php \
--enable-fpm \
--with-config-file-path=/var/home/ap/php/etc \
--enable-libgcc \
--with-openssl \
--with-zlib \
--with-zlib-dir=/usr \
--enable-gd \
--with-freetype \
--with-jpeg \
--with-xpm \
--with-webp \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-dba=shared \
--enable-exif \
--enable-gd-jis-conv \
--with-gettext \
--enable-mbstring \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-pcntl \
--with-readline \
--enable-soap \
--enable-sockets \
--with-xsl \
--with-imap=/var/home/lib/c-client \
--with-imap-ssl=/var/home/lib/openssl \
--with-libdir=lib64 \
--with-zip \
--enable-intl \
--enable-opcache \
--enable-shared
make all
(約13分かかる)
make install
mv /var/home/ap/php /var/home/ap/php8.3.21
ln -s /var/home/ap/php8.3.21 /var/home/ap/php
・APCu拡張モジュールのインストール
wget https://pecl.php.net/get/apcu-5.1.24.tgz
※ https://pecl.php.net/package/APCu
tar xvfz apcu-5.1.24.tgz
cd apcu-5.1.24/
/var/home/ap/php/bin/phpize
CPPFLAGS="-I/var/home/lib/c-client/include" \
./configure --enable-apcu --with-php-config=/var/home/ap/php/bin/php-config
make all
make install
Installing shared extensions: /var/home/ap/php/lib/php/extensions/no-debug-non-zts-20230831/
Installing header files: /var/home/ap/php/include/php/
・ImageMagick拡張モジュールのインストール
wget https://pecl.php.net/get/imagick-3.7.0.tgz
※https://pecl.php.net/package/imagick
tar xvfz imagick-3.7.0.tgz
cd imagick-3.7.0
/var/home/ap/php/bin/phpize
CPPFLAGS="-I/var/home/lib/c-client/include" \
PKG_CONFIG_PATH=/var/home/lib/imagic/lib/pkgconfig/ \
./configure --prefix=/var/home/ap/php/lib/php/extensions/no-debug-non-zts-20230831/ \
--with-libdir=/var/home/lib/imagic/lib \
--with-php-config=/var/home/ap/php/bin/php-config
make all
cp modules/imagick.so /var/home/ap/php/lib/php/extensions/no-debug-non-zts-20230831/
以上です!お疲れ様でした!