Compile PHP 7.4 with OpenSSL

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:

  1. Install OpenSSL
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

  1. Export the variable PKG_CONFIG_PATH to point to pkgconfig directory
export PKG_CONFIG_PATH=/opt/openssl-1.1.1i/bin/lib/pkgconfig (This path changes as per your openssl path)

  1. Compile and install PHP.
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

  1. Test the OpenSSL Version
/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

Comments are closed.