0

I recently upgraded to High-Sierra and now my local server won't run PHP (code shows it as text)

To try and solve the issue I removed all php versions with homebrew and installed php 7.2 using homebrew. But the issue remains.

I don't see any error in the local server log files.

P.S. I do not see attempted to add

LoadModule php7_module   /usr/local/opt/php72/libexec/apache2/libphp7.so

But the path seems to be wrong since I get an error..

Roy Granit
  • 325
  • 2
  • 20
  • that will be solved in your httpd server configurations. You must have a mime type for .php files, which probably got nuked when installing sierra. – YvesLeBorg Feb 04 '18 at 14:59
  • can you pls share more details? – Roy Granit Feb 04 '18 at 15:02
  • there is a ton of q/a here about why php is echoed as is (ie not executed). I gave you the most (by far) likely reason. – YvesLeBorg Feb 04 '18 at 15:05
  • yes, thanks, but I'm not sure how to actually do this.. – Roy Granit Feb 04 '18 at 15:06
  • 1
    **[This is the ultimate guide](https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions)** for configuring httpd and php on osx sierra. Read it carefully, you should be able to relegate the shipped version to obivion without removing it – YvesLeBorg Feb 04 '18 at 15:11
  • Try adding `Include /private/etc/apache2/other/*.conf` to your `/private/etc/apache2/httpd.conf` file. At the end. Inside that included folder there should be a file called `php7.conf`. Then restart apache and try again. That's what macOS Server does, anyway. Furthermore, `LoadModule php7_module /usr/local/opt/php72/libexec/apache2/libphp7.so` is commented with a `#`, at least in my working configuration. Except that the path is different: `#LoadModule php7_module libexec/apache2/libphp7.so`. – Zeke Feb 04 '18 at 15:16

1 Answers1

0

Turns out I had to reinstall XCode Command Line Tools and this solved the issue

Roy Granit
  • 325
  • 2
  • 20