I have a very similar question as this PHP not working after upgrading to OS Mojave so it's not a duplicate as I get a different error
I had Apache and PHP working absolutely fine running on High Sierra and I've upgraded to Mojave recently. Now it doesn't work at all.
I try going to localhost and I get
This page isn’t working localhost didn’t send any data.
I tried running
sudo apachectl configtest in the terminal and this was the output
httpd: Syntax error on line 545 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf:
Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): no suitable image found.
Did find:\n\t/usr/local/php5/libphp5.so: code signature in (/usr/local/php5/libphp5.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\t/usr/local/php5/libphp5.so: stat() failed with errno=22
How can I fix this?