Unable to use PHP on since upgrading to Mac OS Monterey

Unable to use PHP on since upgrading to Mac OS Monterey

I'm aware PHP had been deprecated in previous Mac OS versions, and that it is now removed. My goal is to get it back up and running with latest version PHP (v8.0.12)

I installed PHP 8 via Brew after researching various solutions, including this one

The Apache worker seems to be working fine, it responds to changes implemented in /private/etc/apache2/httpd.conf

BUT so far I can't get the server to execute .php files. It merely displays the contents.

Create your certificate as described in https://www.simplified.guide/macos/keychain-cert-code-signing-create

Find the path of libphp7.so module in your system, In my case with homebrew it is- /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so

Then execute command

codesign -s "YOUR CERTIFICATE NAME" --keychain ~/Library/Keychains/login.keychain-db /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so

Finally in httpd.conf- add this code

LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so "YOUR CERTIFICATE NAME"

Restart Apache

sudo apachectl restart

In my case, it is working now.

@jyotipawar

Fixing your replay:

 codesign -s "YOUR CERTIFICATE NAME" --keychain ~/Library/Keychains/login.keychain-db /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so

In addition to the certificate issue, Apache also throws an error on architecture, the mismatch of PHP Mach-0 and ARM-64. So, web pages fail.

Where can a PHP for ARM 64 be found?

Thank you, Harry

Unable to use PHP on since upgrading to Mac OS Monterey
 
 
Q