Upgraded to Mac OS 12 today and noticed PHP was removed. Have installed PHP 8 using brew. I’ve tried setting it up with the default httpd and also tried installing it with brew. I load the module in the config. In both cases, when I access the files on the localhost in my browser, it just prints the text in the php files and doesn’t execute them. Haven’t really got any clue left
2
Answers
You need to add the line
AddType application/x-httpd-php .php
to httpd.conf Apache configuration file to enable PHP file parsing. After editing the file restart Apache to reload new settings.You can use an alternative like MAMP (My Apache MySQL and PHP). Installation instructions here: https://documentation.mamp.info/en/MAMP-Mac/Installation/.
It includes a prepackaged Apache/nginx web server, PHP and MySQL, as well as, a management GUI app native to macOS.