Jack Skinner

Ramblings of a programmer

Install PHP7.1 on OSX with homebrew

now 3 commands and an update!

blog

php upgrade

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

^Update3rd 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

Woohoo!

Upgrade guides

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.

As with last year's guide, you'll also find Travis CI supports the latest alpha's. They've aliased 7.1 as one of their officially supported php versions.

Happy coding!

Attrib: PHP7.1 logo by PHP 7.1. RM Davey Shafik, presented during his PHPConf.asia keynote