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

Julien Balmont
Zenchef’s Tech and Product Blog
1 min readJan 16, 2017

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”

--

--