PHP not working after upgrading to OS Mojave

apachemampmojavePHP

When i try to open localhost it gives me 403 error message like this "You don't have permission to access / on this server."
I have tried changing the permission but nothing happens. It worked fine with High Sierra but after update its not working.I am using the pre installed apache and not using third party apps like xamppenter image description here

Best Answer

I had the same problem - it's based on mod_userdir exclusion after updating to Mac OS X Mojave. There are a few steps to repair that:

  1. Load the module mod_userdir in /etc/apache2/httpd.conf
  2. At the end of the httpd.conf make sure to load httpd-userdir.conf
  3. In httpd-userdir.conf include a local file in /etc/apache2/users/<username>.conf
  4. Put a directory section into that file, containing the rules for the directory where your webserver files are located:

    <Directory "/Users/<myusername>/Sites/">
        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted
    </Directory>
    

This should set you up.