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

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 php70You 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

Julien Balmont

Written by

Zenchef’s Tech and Product Blog

Zenchef’s engineers and designers blog