PHP 7.3 has been released, bringing some great new features to the language such as trailing commas in function calls, throwing errors when JSON parsing fails, array_key_first()
/ array_key_last()
functions, and much more!
Here's a brief guide on how to install PHP 7.3 on Linux, Windows, and OS X:
Ubuntu
PHP 7.3 and commonly-used extensions can be installed by adding Ondřej Surý's PPA:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
You can then install PHP 7.3 with all common extensions and SAPIs like so:
sudo apt-get install php7.3
Or you can specify individual packages like this instead:
sudo apt-get install php7.3-cli php7.3-fpm php7.3-bcmath php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-zip
This method is supported on:
- Ubuntu 14.04 (Trusty)
- Ubuntu 16.04 (Xenial)
- Ubuntu 18.04 (Bionic)
- Ubuntu 18.10 (Cosmic)
Debian
Ondřej Surý also provides PHP 7.3 packages for Debian 8 (Jessie) and Debian 9 (Stretch). Add the repository with these commands:
sudo apt-get install -y apt-transport-https lsb-release ca-certificates wget
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
And then either install PHP 7.3 with all the defaults like this:
sudo apt-get install php7.3
Or list the exact packages you want instead:
sudo apt-get install php7.3-cli php7.3-fpm php7.3-bcmath php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-zip
CentOS / RHEL & Fedora
Remi's RPM repository has RPMs for the latest PHP 7.3 builds. Refer to Remi's blog post on how to best install this depending on which OS version you're running.
Mac OS X
PHP 7.3 can be installed easily using Liip's php-osx
tool - simply run the following in your terminal:
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
Or, if you prefer using Homebrew:
brew install [email protected]
Windows
Windows users can find the PHP 7.3 distributions on the windows.php.net website.
Additional instructions for installing the distribution can be found in this blog post: http://kizu514.com/blog/install-php7-and-composer-on-windows-10/
phpbrew
phpbrew is an amazing tool that helps you download, compile, and manage multiple versions of PHP on your machine. Assuming you've already followed the installation directions and have phpbrew
up-and-running, PHP 7.3.0 can be installed with two easy commands:
phpbrew update
phpbrew install -j $(nproc) 7.3.0 +default
Docker
Official PHP images can be found on Docker Hub. Use the php:7.3
tag for your base images.
Docker is also a great way to tinker with PHP 7.3 in a local interactive shell without installing it first! Simply run this in your terminal:
docker run -it --rm php:7.3
Was This Helpful?
Support my open-source work via Github or follow me on Twitter for more blog posts and other interesting articles from around the web. I'd also love to hear your thoughts on this post - simply drop a comment below!