Last year I published this handy guide for installing PHP 7 on homebrew. This week, I went and bumped my local machine to the new 7.1 beta3^, and here’s how.
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.
Steps to upgrade
Update3 December 2016 — PHP 7.1 is now stable and this guide is updated accordingly.
Make sure brew is up to date:
brew update brew upgrade
(I kinda helped make that update happen! Woo!)
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 php70 brew install php71
And the result?
$ php --version PHP 7.1.0 (cli) (built: Dec 2 2016 03:30:24) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
Upgrading is always different for everyone and every project. Here’s a few links to help you update your project or library.
If you haven’t already ported your code to 7.0 you can also head over to the official migration guide from php.net to review the full changes.
There’s also the official 7.1 migration guide – but remember its still a work in progress as a beta release.