Psst - PHP 7.4 is now available! Learn how to upgrade to PHP 7.4 here!

PHP 7.1 has been released, bringing some great new features and enhancements to the language such as nullable types, the iterable pseudo-type, catching multiple exceptions, and much more.

Here's a brief guide on how to install PHP 7.1 on several different operating systems:

Ubuntu 14.04 - 16.10:

PHP 7.1 can be installed using Ondřej Surý's PPA:

sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.1

View full list of available packages

Debian 8 (Jessie)

Ondřej Surý also provides PHP 7.1 packages for Debian which can be installed using these commands:

apt-get install apt-transport-https lsb-release ca-certificates wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list apt-get update apt-get install php7.1

Debian 7 (Wheezy)

PHP 7.1 can be compiled from source by following the instructions outlined here: Install PHP 7 on Debian Wheezy. Make sure you git checkout the appropriate tag after cloning the php-src repository.

CentOS / RHEL 7.2 & 7.3

The Webstatic Yum repository does not have the PHP 7.1 GA packages yet, so we can use Remi's RPM repository instead.

First, you'll want to ensure that the EPEL repository is configured (and enable the optional channel for RHEL too):

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm # For RHEL, run this command as well: subscription-manager repos --enable=rhel-7-server-optional-rpms

Next we enable the remi-php71 repository:

yum install yum-utils yum-config-manager --enable remi-php71

And now we can install PHP 7.1:

yum install php71

CentOS / RHEL 6.8

The Webstatic Yum repository does not have the PHP 7.1 GA packages yet, so we can use Remi's RPM repository instead.

First, you'll want to ensure that the EPEL repository is configured (and enable the optional channel for RHEL too):

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm # For RHEL, run this command as well: rhn-channel --add --channel=rhel-$(uname -i)-server-optional-6

Next we enable the remi-php71 repository:

yum install yum-utils yum-config-manager --enable remi-php71

And now we can install PHP 7.1:

yum install php71

Mac OS X 10.6 - 10.12

PHP 7.1 can be installed using homebrew:

brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php brew install php71

Or you can install it via Liip's php-osx tool:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1

Windows

PHP 7.1 distributions for Windows can be found on the windows.php.net website: http://windows.php.net/download#php-7.1

You can find instructions for installing the distribution here: https://www.webtechgadgetry.com/install-php-7-windows/