To use PHP 7.4.33 on Oracle Linux 9.2 with the OpenSSL extension, OpenSSL needs to be installed next to the system-packaged version as
PHP 7.1-8.0 requires OpenSSL >= 1.0.1, < 3.0 (ref)
and you find version 3 on the system:
# openssl version
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)
Example Build
References to source code:
Preparation / Download
Obtaining the tarballs and installing some build dependencies:
# wget -nc https://www.openssl.org/source/openssl-1.1.1u.tar.gz https://www.php.net/distributions/php-7.4.33.tar.xz &&
<<SHA256SUMS sha256sum -c && dnf install -y libcurl-devel libxml2-devel perl-core sqlite-devel
e2f8d84b523eecd06c7be7626830370300fbcc15386bf5142d72758f6963ebc6 openssl-1.1.1u.tar.gz
924846abf93bc613815c55dd3f5809377813ac62a9ec4eb3778675b82a27b927 php-7.4.33.tar.xz
SHA256SUMS
...
Building OpenSSL 1.1.1 and PHP 7.4.33
The legwork you can find in Q&A How to compile PHP 7.4.33 correctly with OpenSSL 1.1.1 on Ubuntu 22.04, just a small recipe for how I could get it to build, but I have not tested it much beyond that:
# rm -rf openssl-1.1.1u &&
tar --extract --file=openssl-1.1.1u.tar.gz &&
cd openssl-1.1.1u &&
./Configure --prefix=/opt/build --openssldir=/opt/build -fPIC -shared linux-x86_64 &&
make -j 8 &&
make test &&
make install &&
cd .. &&
export PKG_CONFIG_PATH=/opt/build/lib/pkgconfig &&
export OPENSSL_CONF=/opt/build/openssl.cnf &&
rm -rf php-7.4.33 &&
tar --extract --file=php-7.4.33.tar.xz &&
cd php-7.4.33 &&
./buildconf &&
./configure --prefix=/opt/php --with-curl --with-openssl=/opt/build &&
make -j 4 &&
make test &&
make install &&
cd ..
...
This should answer how to specify the --with-openssl=/opt/build argument and the directory.
Verifying with Composer
This is just some extra, checking pubkeys will fail as not installed and this can be ignored for this bare diagnose check (Composer is used here only to run composer-diagnose). You may want to build PHP with the zip extension.
# wget -nc https://getcomposer.org/download/2.5.8/composer.phar &&
<<SHA256SUMS sha256sum -c && COMPOSER_ALLOW_SUPERUSER=1 /opt/php/bin/php composer.phar diagnose
f07934fad44f9048c0dc875a506cca31cc2794d6aebfc1867f3b1fbf48dce2c5 composer.phar
SHA256SUMS
...
composer.phar: OK
Checking platform settings: The zlib extension is not loaded, this can slow down Composer a lot.
If possible, enable it or recompile php with --with-zlib
A php.ini file does not exist. You will have to create one.
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.
Checking git settings: OK git version 2.39.3
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK
Composer version: 2.5.8
PHP version: 7.4.33
PHP binary path: /opt/php/bin/php
OpenSSL version: OpenSSL 1.1.1u 30 May 2023
cURL version: 7.76.1 libz 1.2.11 ssl OpenSSL/3.0.7
zip: extension not loaded, unzip present, 7-Zip not available
Look out for the OpenSSL installation instructions, the build is pretty vanilla which is to demonstrate how to build, but not with secure settings, but merely insecure defaults (for reasons, see installation instructions for details).