PHP

INSTALL LAMPP ON AWS EC2 UBUNTU 18.04

Pinterest LinkedIn Tumblr
STEP 1: INSTALL APACHE

Update package list from repositories for packages that needs upgrading.

sudo apt-get update

Upgrade packages that needs upgrading.

sudo apt-get upgrade
Install Apache2

sudo apt-get install apache2

After installing Apache2 use below commands to stop, start and enable apache2 to run as a service so that it can start automatically after server reboots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

STEP 2: INSTALL PHP7.2 AND OTHER PHP EXTENSIONS
Add Repository to download and install PHP7.2 and extensions.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
Update package list.

sudo apt-get update
Install PHP and related extensions.

sudo apt install php7.2-fpm php7.2-common php7.2-mysql php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-bcmath php7.2-xml php7.2-cli php7.2-zip

Let’s tune up some php settings. Run below command

sudo nano /etc/php/7.2/fpm/php.ini
Adjust parameters according to below settings, and the save and exit.

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
max_execution_time = 360
Do the same settings in cli as well. Run below commands and update the parameters as per above list.

sudo nano /etc/php/7.2/cli/php.ini
Inorder to make above settings take effect restart apache and php-fpm. Run below commands to do so

sudo service php7.2-fpm restart
sudo systemctl restart apache.service
To test successful php installation create a new phpinfo file under /var/www/html directory

sudo nano /var/www/html/phpinfo.php
Add below contents, save and exit.
Source: https://webnlinux.com/install-lampp-on-aws-ec2-ubuntu-16-04-18-04/

Write A Comment