xxxxxxxxxx
*********************** Change PHP version *****************************
step.1
sudo yum-config-manager --enable epel
yum install dnf -y
step.2
yum install epel-release yum-utils -y
step.3
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
step.4
dnf install php74.x86_64
step.5
dnf clean metadata
step.6
dnf install php-cli php-pdo php-fpm php-json php-mysqlnd
step.7
dnf list installed php-cli php-pdo php-fpm php-json php-mysqlnd
step.8
which php
step.9
php -v
step.10
yum update
step.11
sudo systemctl restart httpd
xxxxxxxxxx
sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras | grep php
sudo amazon-linux-extras enable php7.4
sudo yum install php php7.4-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
xxxxxxxxxx
1. Run System Update
sudo yum update
2. Check If amazon-linux-extras is installed
which amazon-linux-extras
sudo yum install -y amazon-linux-extras
3. Check for Available PHP packages/topics in amazon-linux-extras repo
amazon-linux-extras list | grep php
4. Enable the PHP 8.1
sudo amazon-linux-extras enable php8.1
5. Install PHP 8.1 from amazon-linux-extras repo
sudo yum clean metadata && sudo yum install php-cli php-pdo php-fpm php-json php-mysqlnd
OR
sudo amazon-linux-extras install php8.1
Enter y when prompted and your packages get installed on the system.
6. Verify the PHP Installation
php --version