1

I installed PHP 7.4.5 from source code on an Oracle Linux Server release 9.2.

The developer informed me that OpenSSL needs to be enabled.

When I check the installed PHP info, it shows:

OpenSSL support => disabled (install ext/openssl)

How do I enable PHP support?

I'm building PHP for the first time and I'm running the commands below.

$ ./configure
  ...
$ make
  ...
$ make install
  ...

The entire process runs without errors, but openSSL is still disabled.

[root@hostname php-7.4.5]# php -i
phpinfo() PHP Version => 7.4.5
  ...
OpenSSL support => disabled (install ext/openssl)
  ...

As it shows, OpenSSL is still disabled.

8
  • I'm trying compiled with ./configure --with-openssl --with-openssl-dir=/usr/local/bin/, but, after running make && make install, present the error: make: *** [Makefile:600: ext/openssl/openssl.lo] Error 1 Commented Jul 27, 2023 at 11:46
  • Are you building PHP for the first time? You should edit the question and show the commands and the error message (and add that line 600, too) to the question, comments hide that from it and may get deleted. Additionally it is often helpful you share your understanding of the error message as that is basically what you're asking about. HTH and welcome to Stack Overflow. Commented Jul 27, 2023 at 13:16
  • "Can I install PHP already with support enabled?" Yes, this is possible. But the problems you achieving it may still remain, so better share your understanding of the concrete error message, see my last comment. Commented Jul 27, 2023 at 13:17
  • @hakre After executing: ./configure make make install [root@hostname php-7.4.5]# php -i phpinfo() PHP Version => 7.4.5 But openssl is disabled OpenSSL support => disabled (install ext/openssl) Commented Jul 27, 2023 at 14:31
  • "To use PHP's OpenSSL support you must also compile PHP --with-openssl[=DIR]." ref. Did you do that? Commented Jul 27, 2023 at 14:44

1 Answer 1

0

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.