By using AWS re:Post, you agree to the AWS re:Post Terms of Use

How to upgrade to PHP8.0 on Amazon Linux 2 EC2 instance?

1

Hi, I have upgraded the software I am hositng on EC2 instance but to funciton it requires PHP 8.0. I was not able to upgrade the PHP using the yup update and other Amazon tools I found on the forums. PHP version is stuck at 7.x and I really need to update to 8.0 on an urgent basis. Can you pleaes help?

asked a year ago9.7K views
3 Answers
2

You can install PHP 8.0, 8.1, 8.2 from amazon-linux-extras

amazon-linux-extras | grep php

May need to remove existing php7 packages first, before you enable 8.x package

sudo yum remove php*
sudo yum clean all
sudo amazon-linux-extras enable php8.0
sudo yum clean metadata
sudo yum install -q -y php-cli php-fpm php-opcache php-common
AWS
EXPERT
answered a year ago
0

Have you tried

take a snapshot of your instance, Take a copy of php.ini, List the modules that you installed with php, yum remove -y php and its modules (php -m will give the modules list), amazon-linux-extras disable php7version, amazon-linux-extras enable php8version, yum install php and its modules.

answered a year ago
0

Have you tried changing the version of PHP using the following command

sudo update-alternatives --config php
profile picture
EXPERT
answered a year 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