Psst - PHP 7.4 is now available! Learn how to upgrade to PHP 7.4 here!
Here's a brief guide on how to install PHP 7.2 on several different operating systems:
Ubuntu 14.04, 16.04, 17.04, 17.10, & 18.04
PHP 7.2 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.2-cli
Debian 8 (Jessie) and 9 (Stretch)
Ondřej Surý also provides PHP 7.2 packages for Debian which can be installed using these commands:
sudo apt-get install apt-transport-https lsb-release ca-certificates sudo 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" | sudo tee /etc/apt/sources.list.d/php.list sudo apt-get update sudo apt-get install php7.2-cli
Debian 7 (Wheezy)
PHP 7.2 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 6+ & Fedora 25+
Remi Collet, one of the release managers for PHP 7.2, also publishes RPM packages for this new version. You can use the configuration wizard to determine the exact setup steps, or see Remi's website for additional details about the 7.2.0 release.
Mac OS X
PHP 7.2 can easily be installed via Liip's php-osx tool:
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2
Or, if you prefer using Homebrew:
brew tap homebrew/homebrew-php brew install php72
You can find instructions for installing the distribution here: https://www.webtechgadgetry.com/install-php-7-windows/
phpbrew is a really nice tool that helps you download, compile, and manage multiple versions of PHP. Assuming you’ve already followed the installation directions and have phpbrew up-and-running, PHP 7.2.0 can be installed with two easy commands:
phpbrew update phpbrew install -j $(nproc) 7.2.0 +default
Official PHP images can be found on Docker Hub. You can use the
php:7.2 tag for base images.
If you'd like to tinker with PHP 7.2 in an interactive shell, simply run this in your terminal:
docker run -it --rm php:7.2