Setting up Apache and PHP on macOS High Sierra

Recently, I had to setup Apache with PHP directly on my mackbook. It was rather easy.

I did the following:

  • sudo apachectl start
  • sudo nano /etc/apache2/httpd.conf
    • #LoadModule php7_module libexec/apache2/libphp7.so
      uncomment, remove the #
    • #LoadModule rewrite_module libexec/apache2/mod_rewrite.so
      uncomment, remove the #
  • replace /Library/WebServer/Documents with /Users/<your user>/<your folder>
  • sudo apachectl restart

Source: