PHP-Openssl extension for Amazon Linux 2023

0

I'm looking for guidance on how to install/enable PHP-OpenSSL extension for AL2023 OS?

We are running PHP 8.2.20 on AL 2023. We installed PHP core as a third-party software. With this we need to install PHP-OpenSSL. https://www.php.net/manual/en/book.openssl.php, this site has the extension.

With my limited knowledge of PHP, how do I go about installing?

Thank you in advance.

  • Arun.
asked 2 months ago245 views
3 Answers
1

Hello.

I started EC2 on Amazon Linux 2023 with my AWS account and installed php8.2.

sudo dnf install php8.2 -y

When you check the installed modules using the "php -m" command, "opnessl" is included, so I think it is installed by default.

php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
random
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache
profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile pictureAWS
EXPERT
reviewed 2 months ago
  • Thank you!

    I need php version 8.2.20, per our security requirements. What is the upgrade process?

    sh-5.2$ php -v PHP 8.2.18 (cli) (built: Apr 9 2024 18:46:23) (NTS gcc x86_64) Copyright (c) The PHP Group Zend Engine v4.2.18, Copyright (c) Zend Technologies with Zend OPcache v8.2.18, Copyright (c), by Zend Technologies

  • The default repository used by Amazon Linux2023 installs 8.2.12, so 8.2.20 cannot be installed. 8.3 is distributed in the Amazon Linux 2023 repository, so why not use it?

    dnf search php8.3
    Last metadata expiration check: 0:02:23 ago on Sun Jul 28 01:17:33 2024.
    ========================================================================================== Name Exactly Matched: php8.3 ==========================================================================================
    php8.3.x86_64 : PHP scripting language for creating dynamic web sites
    
  • Delete php8.2 and then install php8.3 as shown below. I also recommend that you create a snapshot of EC2 before executing the command below. If possible, create a test environment to test the upgrade before upgrading the production environment.

    sudo dnf remove php8.2
    sudo dnf install php8.3
    
1

Hi,

If your goal is to have ssl / tls encryption, the full procedure for AL2023 is detailled here: https://docs.aws.amazon.com/linux/al2023/ug/SSL-on-amazon-linux-2023.html

Best,

Didier

profile pictureAWS
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
0

The customer is requesting us to be on PHP version 8.2.20 on Amazon Linux 2023.

Just to recap we got PHP package from Amazon repo and that is at 8.2.18. There are no updates to this.

Uninstalled 8.2.18 and installed 8.2.20 as a third-party package. Now, many of the PHP extensions are missing in this version compared to 8.2.18. How do we get them installed? For example, openssl is missing Any pointers or any blogs that could be shared.

Thanks again.

-A

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions