0

I have been messing around with apache in the terminal on macOS Catalina 10.15.4. I was following tutorial & tutorial2. I got everything working, up to a point. The localhost displays just fine and I can add html websites to the default domain and they load perfectly. My issues are:

  1. PHP is not parsing from default apache folder. Just displays code in browswer.
  2. I have tried editing the document root in httpd.conf, but nothing changes
  3. I have tried to undo most of what I have done so far, but now I am getting this error:

'Set the 'ServerName' directive globally to suppress this message'

Any advice? Is there a way to reset all apache's settings to their default values?

jvarela
  • 3,744
  • 1
  • 22
  • 43
demowil
  • 1
  • 2
  • Does this answer your question? [Apache shows php code instead of executing](https://stackoverflow.com/questions/12142172/apache-shows-php-code-instead-of-executing) – YvesLeBorg Mar 30 '20 at 20:23

1 Answers1

0

make certain that in your /usr/local/etc/http/httpd.conf you have something like:

LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so

<IfModule php7_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
</IfModule>

ymmv. I am assuming you brewed in apache, and you have php installed.

This works on mojave, with apache and php7.2 brewed. Adapt to your own setup. Never wanted ever to downgrade to catalina, so i dunno how the apple and brew crews mangled the configurations, but should be close.

YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48