Muhammad Harits Syaifulloh

Friday, December 2, 2016

Installing PHP 7.1 in macOS Sierra using Homebrew

After PHP 7.0 was released a few month ago, now PHP released the new version and it's 7.1. And now welcome back to Ask MHS to follow the tutorial about Installing PHP 7.1 in macOS Sierra using Homebrew. It's very easy to install PHP 7.1 if you're using package manager like Homebrew. You can follow this tutorial to install Homebrew in macOS. And after you're already, come on lets go installing PHP 7.1.

If you've already installed 7 locally, chances are you've already run a simple sudo xcodebuild -license to sort out Xcode's license agreement.

Make sure brew is up to date:
brew update
brew upgrade
If you're not already running php7 then you may need:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php

And then the complicated part:
brew unlink php56 -> If you're running PHP 5.6 beforebrew unlink php70 -> If you're running PHP 7.0 beforebrew install php71

Then run nano ~/.bash_profile in your Terminal then press Enter and paste this code there:
export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
Then hit Cmd + X and then press Y. Now quit you Terminal and open it back.

And the result?, just run php --version for displaying the result.
$ php --versionPHP 7.1.0RC6 (cli) (built: Nov 9 2016 04:48:00) ( NTS )Copyright (c) 1997-2016 The PHP GroupZend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
Alright we have done Installing PHP 7.1 in macOS Sierra using Homebrew. Share this post if you're like this post. Thank you very much for visit my blog ans if you have any question or problem just leave some comment below and I'll reply it soon.

No comments:

Post a Comment