Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.37 KB

how-can-i-use-yum-to-install-php-on-an-amazon-ec--instance.md

File metadata and controls

53 lines (41 loc) · 1.37 KB

How can I use Yum to install PHP on an Amazon EC2 instance?

// plain

Yum is a package manager for Linux distributions that can be used to install PHP on an Amazon EC2 instance. The following steps can be used to install PHP on an Amazon EC2 instance using Yum:

  1. Update the Yum package manager:
sudo yum update
  1. Install the PHP packages:
sudo yum install php php-mysql
  1. Verify the installation by running the following command:
php -v

Output example

PHP 7.2.34 (cli) (built: Mar 24 2020 11:01:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
  1. Configure the PHP settings:
sudo vi /etc/php.ini
  1. Restart the Apache web server:
sudo service httpd restart
  1. Test the PHP installation by creating a PHP info page:
sudo vi /var/www/html/info.php
  1. Test the page by visiting the URL in a web browser:
http://<ec2-instance-ip>/info.php

Helpful links

onelinerhub: How can I use Yum to install PHP on an Amazon EC2 instance?