There are many ways to get the latest PHP version running on your mac,
but so far the one that seemed the least complicated is to use phpbrew
Start here: https://github.com/phpbrew/phpbrew
From there, there are instructions for getting PHP installed. It's also used as a version switcher, which can be useful for managing multiple projects with different version requirements.
I noticed, the build failed because of a missing component called "libmcrypt". To fix that I just installed that with homebrew: