Stuck in upgrading PHP version on localhost Mojave
You're trying to use the PHP module from HomeBrew with the Apple-provided Apache web server. That is an unsupported configuration on Mojave.

It doesn't work because macOS tries to validate that your software is correctly signed (i.e. not tampered with) - and it fails this check after you have changed which binaries are going to be loaded in. You can fix this by disabling SIP (System Integrity Protection) - but that is a really bad idea, as this would disable the protection on your other programs as well.

The correct way to proceed is to stop using the built-in Apache web server, and instead use a different web server. The easiest transition is to simple use Apache provided by HomeBrew instead.

You can do that by first installing Apache from HomeBrew:

brew install httpd


Then stop macOS from starting up the Apple-provided Apache on boot:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist


Make sure that the new php module line you have inserted is now not commented, and the old is - i.e. make it look like this:

#LoadModule php7_module libexec/apache2/libphp7.so
LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so


Then start up the new Apache web server installation:

brew services restart httpd


Depending on your settings you will then be able to connect with your browser to localhost:80 or localhost:8080 to view your site.