Use Homebrew to install and manage PHP versions in your local environment.


which php

# /usr/local/bin/php
php -v

# PHP 7.1.13 (cli) (built: Jan  5 2018 15:31:15) ( NTS )
# Copyright (c) 1997-2017 The PHP Group
# Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Switch PHP version

Use Homebrew to install different PHP versions.

Edit your shell profile to change which PHP library is executed from the command line.