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.
READ MORE
Install PHP 8.0 on Ubuntu 18.04 / 20.04
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.
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.
Bilal Shafqat
Related posts
New Articles
Fix BlueBubbles Socket Connection Error: Easy Troubleshooting
BlueBubbles enables Android users to use iMessage, creating a bridge between Apple’s messaging system and non-Apple devices. However, users may…