How to: Install PHP 7 on Ubuntu 14.04 / 16.04
It’s release day! Or it was on the 3rd of December 2015 – the release date for the final version of PHP 7.0. There have been a whole host of improvements made to PHP but we won’t delve too deep into changes. This is a very quick guide on how to update to the latest release for those of you running a Ubuntu Linux system.
It is very simple, thanks to ondrej managing a ppa repo for this release, like many of the previous releases. All we need to do is add the ppa to our system, update the software sources and install our new version of PHP.
# Ubuntu 14.04 Only sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm
Other packages which might be useful include:
sudo apt-get install php-mcrypt php7.0-soap php7.0-mbstring php7.0-intl php7.0-xml php7.0-curl php7.0-gd
You should now be running the latest and greatest within the PHP world. The easiest way to test if it’s working for you is to run:
And it should look like:
Note: If you are also trying to install phpmyadmin, see more information here.
Edit 15/01/16: Moved to the
ppa:ondrej/php repo instead of
ppa:ondrej/php7.0 (because the two sets of packages can co-exist).
Do you think this is missing any modules? If so, let us know in the comments.
Photo by C. Evans