Apache2 With PHP 7.1 Support On Ubuntu 18.04 LTS Server


Step 1: Install Apache2 Web Server

sudo apt install apache2

After installing Apache2, the commands below can be used to stop, start, 
reload and enable Apache2 service to always startup when the server boots up.

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

Step 2: Install PHP And Related Modules

PHP 7.1 may not be available in Ubuntu default repositories… in order to install it, 
you will have to get it from third-party repositories.
Run the commands below to add the below third party repository to upgrade to PHP 7.1

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then update and upgrade to PHP 7.1

sudo apt update

Finally, run the commands below to install PHP 7.1 and related modules..
sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-mcrypt php7.1-cli php7.1-xml php7.1-zip php7.1-mysql php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.