Upgrade to PHP 7.x on Ubuntu 14.04 LTS

Upgrading to PHP 7.x (7.0 or 7.1 as of the time of this writing) is just as easy
as it is to upgrade to PHP 5.6!

Before we install PHP 7.x, I would recommend getting your system up to date:

sudo apt-get update

Next you will need to add the deb.sury.org PPA:

sudo add-apt-repository ppa:ondrej/php

If add-apt-repository isn’t found, you can install it by way of the
python-software-properties package:

sudo apt-get install python-software-properties

Once you get the PPA added, you’ll want to do an update so the packages show up:

sudo apt-get update

At this point, you can install PHP 7.x and any extensions you may want.

sudo apt-get install php7.0 # For PHP 7.0
sudo apt-get install php7.1 # For PHP 7.1

Scary Warning: Installing the php7.x packages will install Apache, even if
you have another web server already installed. This is just how the meta package
is setup. You can install php7.x-cli and/or php7.x-fpm directly without
installing Apache. If you do end up installing Apache and don’t want or need it,
just uninstall it.

At this point, you should have PHP 7.x up and running on your server!

Once installed, you will want to restart your web server and your fast process
manager (if you use one) and you should be good to go!

One additional note, the PPA I mentioned in this article is provided free of
charge by Ondřej Surý. The PPA may be free, but his time maintaining it is not.
Please consider donating if you found this article or his PPA useful.

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.