Reputation: 1418
I am trying to compile PHP 7.2.5
on a RedHat operation system. I already compiled OpenSSL 1.1.0h
on my own in a directory of my own /home/user/openssl-1.1
. These are the lines how I compiled OpenSSL
TARGET_DIR=/home/usr/openssl-1.1
# ...
./config no-shared --prefix=${TARGET_DIR} --openssldir=${TARGET_DIR}/conf
make INSTALL_PREFIX=${TARGET_DIR}
make install
Now, I want to compile PHP 7.2.5
together with the compiled OpenSSL version. I do it with these lines:
PHP_PREFIX=/home/user/php-7.2
export OPENSSL_INCLUDE_DIR=/home/user/openssl-1.1/include/openssl
# ...
./buildconf --force
./configure --prefix="$PHP_PREFIX" \
--enable-sockets \
--enable-embed \
--enable-com-dotnet \
--enable-ctype \
--with-curl \
--enable-mbstring=static \
--with-gd \
--enable-soap \
--enable-pdo=static \
--with-mp \
--with-curl=static \
--with-openssl=static \
--with-openssl-dir="/home/user/openssl-1.1"
But at some point, I get this error message:
configure: error: Cannot find OpenSSL's <evp.h>
This file evp.h
exists in the directory /home/user/openssl-1.1/include/openssl
.
Does anyone know how to fix this problem?
Upvotes: 3
Views: 4011
Reputation: 11
I have tested with PHP 7.2 and 7.4
Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix, point it to pkgconfig directory of OpenSSL.
Procedure:
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
tar xzf /root/tmp/openssl/openssl-1.1.1i.tar.gz
cd openssl-1.1.1i
./Configure --prefix=/opt/openssl-1.1.1i/bin -fPIC -shared linux-x86_64
make -j 8
make install
export PKG_CONFIG_PATH=/opt/openssl-1.1.1i/bin/lib/pkgconfig
tar xzf php-7.4.13.tar.gz
cd php-7.4.13
./configure --prefix=/opt/php-7.4.13 --with-curl --enable-exif \
--with-mhash --enable-mbstring --with-mysqli --enable-mysqlnd \
--with-zlib --with-bz2 --enable-fpm --with-pear -enable-gd\
--with-apxs2=/opt/httpd-2.4.46/bin/apxs - --with-webp \
--with-jpeg --with-xpm --with-freetype --enable-intl \
--disable-ipv6 --with-pgsql --without-sqlite3 --without-pdo-sqlite \
--disable-cgi --enable-soap --without-imap --without-imap-ssl \
--with-openssl=/opt/openssl-1.1.1i/bin \
--with-openssl-dir=/opt/openssl-1.1.1i/bin
make -j 8
make install
/opt/php-7.4.13/bin/php -i | grep -i openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1i 8 Dec 2020
OpenSSL Header Version => OpenSSL 1.1.1i 8 Dec 2020
Openssl default config => /opt/openssl-1.1.1i/bin/ssl/openssl.cnf
Upvotes: 1
Reputation: 1418
I've found a solution for this problem: One has to change the two parameter --with-openssl
and --with-libdir
to something like this:
./buildconf --force
./configure --prefix="$PHP_PREFIX" \
# ...
--with-openssl=/home/user/openssl-1.1 \
--with-libdir=lib64
As fas as I know, no other environment variables are needed here.
Upvotes: 0