Ok, after update macOS from High Sierra to Mojave, Apache with PHP stop working properly, so I did everything as is said in this guide - https://getgrav.org/blog/macos-mojav
I had the same issue after installing the Mac OS Mojave. I have done the following steps and it worked with me:
brew update
then:
brew upgrade
I have edited /etc/apache2/httpd.conf by uncommenting the following line:
LoadModule php7_module libexec/apache2/libphp7.so
Open the terminal and restart the apache server:
sudo apachectl restart
you might find the post on this link helpful