How to install PHP 7 on Ubuntu 16.04

The following article will show you how to install PHP 7.0 on Ubuntu 16.04. The first thing we are going to do is to update our Ubuntu by using the following command:

sudo apt-get update

You will be asked for your password if you are not logged in as the root user.
You can also upgrade your Ubuntu server by typing the following:

sudo apt-get upgrade

Now that we have updated and ppgraded Ubuntu, we will now proceed with installing PHP 7.0. To install PHP 7.0 type the following command in your terminal:

sudo apt-get install php7.0

The command will install PHP 7.0 in addition to other dependencies such as,

  • php-common
  • php7.0
  • php7.0-cli
  • php7.0-common
  • php7.0-fpm
  • php7.0-json
  • php7.0-opcache
  • php7.0-readline

You can verify if PHP is installed by typing the following command:

php –v

Depending on how and what you’re going to use, you may need additional PHP modules and packages. You may need some add some additional packages and PHP modules in order for PHP to work with your applications. You can install the most commonly needed modules with:

sudo apt-get install php-pear php7.0-dev php7.0-zip php7.0-curl php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-xml libapache2-mod-php7.0

To check all the PHP modules available in Ubuntu, type:

apt-cache search --names-only ^php

Now we have installed PHP 7.0 in your Ubuntu Server.

Leave a Reply

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

Translate »