Trending News

Blog

How to Install PHP 7.4, 7.3 or 7.2 on AWS EC2 Instance in [ Easy Guide ]
How To

How to Install PHP 7.4, 7.3 or 7.2 on AWS EC2 Instance in [ Easy Guide ] 

we will teach you how to install PHP 7.4, 7.3, or 7.2 on an AWS EC2 instance in this article. To do so, you must first set up an EC2 instance. After you’ve finished creating your EC2 instance, you’ll need to connect to it via SSH or the EC2 Management console.

Connect your Amazon Web Services (AWS) instance

Before installing PHP, you must update your privileges to root user (sudo su).

Let’s get PHP installed on the EC2 instance.

Installing the Apache Webserver

Check server running status

If you notice that the server is inactive, run the command below to start it.

Now copy and paste the EC2 Instance Public DNS, such as ec2-54-xxx-xxx-xxx.compute-1.amazonaws.com, into your browser and see if the apache server is up and running.

PHP 7.4 installation on server

Check for the inclusion of the amazon-linux-extras package:

Install the package that will configure the repository if the command does not return some output:

PHP 7.4, 7.3, 7.2 installations on Amazon AWS EC2

Let’s double-check that our AWS EC2 machine supports PHP 7.x:

We’ll enable the PHP 7.4 topic in this case, as we can see all PHP 7 topics.

Now, from the repository, install PHP packages.

Accept PHP 7 packages to be installed on AWS EC2.

Check the default PHP Version

To install PHP 7.2, disable 7.4 and 7.3 and enable 7.2.

Check PHP version

Installing PHP 7.3 on Amazon AWS EC2, similar commands can be used.

Learn More: How To Use A Simple Bash Script To Backup MySQL Database

Conclusion:

PHP has now been installed in our EC2 instance. Please ask anything in the comment section if you have any questions.

Related posts