Search code examples
apachemacos-catalina

Mac OS Catalina webserver error : Forbidden You don't have permission to access this resource


I have a problem with my localhost under mac OS Catalina; here is my error obtained, I followed this tutorial https://www.youtube.com/watch?v=hVHFPzjp064 for the procedure to properly configure my local server, if you can help me solve this problem, maybe it is a security on new macs.

My error:

Forbidden
You don't have permission to access this resource.

I thank you in advance


Solution

  • The issue is that the php module is disabled in Catalina. You have to enable it in /etc/apache2/httpd.conf. Follow these steps.

    1. Open Terminal and type sudo nano /etc/apache2/httpd.conf. Enter password when prompted.
    2. Find #LoadModule php7_module libexec/apache2/libphp7.so and uncomment it (delete the leading #)
    3. To make Apache use index.php first,

    scroll down and find the following

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>
    

    change to

    <IfModule dir_module>
        DirectoryIndex index.php index.html
    </IfModule>
    
    1. Press Control + X then Y to save changes. Press enter when prompted for filename
    2. Restart apache by typing sudo apachectl restart

    Now your site root should work since php is enabled.