Installed Apache 2.4 (httpd) using Home Brew, can I get it to use macOS' php7? I'm running macOS 10.15 (Catalina) and have installed the latest Apache (2.4.43) using brew, basically following these steps. 

Seems to be working fine, but now I want to enable PHP 7 in Apache as well. 

I have the default PHP that comes with macOS Catalina (php -v says 7.3.11) however Apache's module dir (at least the latest Apache I installed with Home Brew) does not seem to contain any php modules. 

I'm quite unsure what LoadModule line I have to add in httpd.conf in order to get PHP 7 working in my Apache server. And how or where I should get a PHP 7 .so module file if necessary. 

When searching around I find all sorts of different approaches, including installing custom versions of PHP but I'm somewhat reluctant of the risk of messing up my current installation.

Is there an easy, and more importantly: reliable way of enabling PHP 7 in httpd 2.4?
Just install php with brew (and leave Apple's PHP alone):


brew install php (requires a lot of additional packets)
Modify /usr/local/etc/httpd/httpd.conf at the end of the LoadModule section (~ line 182) and add

LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so

&lt;FilesMatch \.php$&gt;
    SetHandler application/x-httpd-php
&lt;/FilesMatch&gt;


Check that DirectoryIndex (~line 286) includes index.php

DirectoryIndex index.php index.html

Start php:

brew services start php

Restart apache