'localhost prints .php file instead of executing it
I am running macOS 12.2.1 and I have installed php via brew install [email protected]. I have also added the following to my http.conf:
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
But instead of executing my index.php, the browser just prints its code <?php echo 'hello world'; ?>
Now, I know that I'm supposed to add LoadModule php7_module /usr/local/Cellar/[email protected]/7.4.27/lib/httpd/modules/libphp7.so to my httpd.conf as well, but if I do, I get a ERR_CONNECTION_REFUSED.
I have noticed that all the other LoadModules point to a path libexec/apache2/.
Is my path incorrect? The file /usr/local/Cellar/[email protected]/7.4.27/lib/httpd/modules/libphp7.so does exist though... And I cannot find the directory /libexec/apache2/ on my system..
Solution 1:[1]
The answer was missing Code signing, I followed this guide and after a lot of trial and error now it works: https://www.simplified.guide/macos/keychain-ca-code-signing-create
People who work at Apple are horrible people.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tonald Drump |
