macOS
The two most common ways to install PHP on macOS are using Homebrew and MacPorts. The instructions given below assume that you have Homebrew or MacPorts already set up.
Homebrew
$ brew update
$ brew install php74
MacPorts
$ sudo port selfupdate
$ sudo port install php74