How to upgrade your version of PHP to 7.0 on macOS Sierra

Julien Balmont
Jan 16, 2017 · 1 min read
Image for post
Image for post

Usually, with a fresh version of macOS Sierra, you get a PHP 5.6 installed.

You’ve got two options: brew or curl install

Brew

brew update && brew upgrade
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56
brew install php70
You might get an error if PHP 5.6 has not been installed by brew previously, but don't worry, you can simply continue

CURL

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0

You can replace 7.0 by 7.1 in the command above to get version 7.1 of PHP

If the output of php -v still doesn’t echoes the version 7, simply type this command to update your path, it should do the magic, as stated on php-osx.liip.ch website

export PATH=/usr/local/php5/bin:$PATH

Apparently, the env var might have changed depending on your environment.

If the one above doesn’t work, you may try (thanks Robert Borghesi for your comment) :

export PATH=”$(brew — prefix homebrew/php/php70)/bin:$PATH”

Zenchef’s Tech and Product Blog

Zenchef’s engineers and designers blog

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store