Apple macOS comes with Apache and PHP already installed, however Apache and using PHP with it is not enabled by default. This tutorial provides an overview of some of the key tasks related to enabling Apache and PHP; however the needed steps for each version of macOS can vary greatly so you’ll likely want to visit many pages on this topic.
This page has old content and will be updated in the future. In the meantime please see the main macOS Installation from the PHP Group:
Because PHP is already installed you can use the PHP Built-in Web Server for local development and then there is no need for a complex Apache setup. For info on how to do this see Use Visual Studio Code for PHP Development or Using other Code Editors and IDE's for PHP Development.
Recommended Apache, PHP, and MySQL Install Resources for macOS