Install PHP 7.1 on a Mac that Still Runs OSX 10.11 El Capitan

Open a terminal and run. Also, everything you need to know about this package is online at https://php-osx.liip.ch/.
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1
This package installs the PHP 7(in this case, 7.1) on OSX 10.11 (aka El Capitan) in /usr/local/php5. Yes, that looks like an odd place to install PHP 7.1, but it works.
Next, add the directory that holds the binary to your path.
export PATH=/usr/local/php5/bin:$PATH
To make this permanent, you can add export PATH=/usr/local/php5/bin:$PATH
to ~/.profile and relaunch your terminal. If you happen to use iTerm 2, you may need to add this command to ~/.bash_profile
instead.