Suggesting "just" brew install php as in original post is silly to me.
You have to install homebrew first, which is a non-trivial task requiring root access.
It should be trivial to anyone needing it, and by extension anyone needing tools you usually install with homebrew. Unless this is the case you should not need PHP in the first place.