To install and configure php 8.2, 8.1, 8.0 on amazon aws Linux 2 server, You can enable and install it by using sudo amazon-linux-extras enable php8.2 and sudo amazon-linux-extras install php8.2 command on ssh terminal window or command line.
Here are steps to install PHP 8.2 on Amazon aws ec2 Linux 2 server:
Step 1 – Connect to Amazon Aws Linux 2 Server
To connect your Amazon AWS Linux 2 instance from putty ssh or aws terminal.
If you do not know how to connect amazon aws Linux 2 ec2 instance with Windows, Ubuntu, and Mac systems. Read this guide: How to Connect to ec2 Instance From Putty and SSH Terminal.
Step 2 – Update System Packages
It’s a good practice to update your system’s package list and upgrade existing packages:
sudo yum -y update
Step 3 – Install amazon-linux-extras
Let’s install amazon-linux-extras repository by using sudo yum install -y amazon-linux-extras command on amazon linux 2 ssh terminal:
sudo yum install -y amazon-linux-extras
Step 4 – Enable php8.2 on amazon-linux-extras
PHP 8.2 might be available in the default amazon linux extras repositories, Simply use sudo amazon-linux-extras enable php8.2
command on ssh terminal window to enable php8.2 on amazon linux 2 server:
sudo amazon-linux-extras enable php8.2
Step 5 – Install PHP 8.2 on Amazon Aws Linux 2
To install PHP 8.2 on Amazon Linux 2 server, Simply type sudo amazon-linux-extras install php8.2
command on ssh terminal window and press enter:
sudo amazon-linux-extras install php8.2
Now, again type sudo yum update
command to update system:
sudo yum update
Step 6 – Verify the PHP Installation
To verify that PHP 8.2 is installed and configured correctly, simply type php –version command on ssh terminal window and press enter:
php --version
Conclusion
You’ve successfully installed PHP 8.2 on Amazon AWS Linux 2 server and added some common PHP extensions.
Recommended Tutorials
If you have any questions or thoughts to share, use the comment form below to reach us.