How to configure your apache 2 server with php 7

Suppose you have apache 2 server installed in your Ubuntu 14 and it came with php 5*. Now whenever you start apache 2 server typing localhost in your browser, you find that your apache server has not been configured with php 7.1.
Now how you’d solve this nagging problem?
First you need to remove every php version from your machine.

sudo apt-get purge php.*

Next you need to reinstall PHP 7 by these commands one after another:

sudo add-apt-repository ppa:ondrej/php

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.1

sudo apt-get install php7.0-mysql

sudo apt install php libapache2-mod-php

sudo apt install php7.0-mbstring

It’s done. Now your apache server has been configured with php latest version.

This article was written by ss

Sanjib Sinha is an Author, and Full Stack Web Developer.

He writes stories; as well as codes. His book “The Beginning Ethical Hacking with Python” (Apress) has been one of the most downloaded IT books in 2016-17 (Provided by Bookmetrix). Know his journey as a writer: http://sanjibsinha.com.

He loves to connect through his social media handle: @sanjibsinha.

Leave a Reply

Your email address will not be published. Required fields are marked *