php – Forbidden: You don't have permission to access / on the server-ThrowExceptions

Exception or error:

This is the error that I get when I try to access the PC from my phone.

enter image description here

How to solve:

in your apache.conf file

<Directory "/var/www/html/yourwebroot">
    AllowOverride All 
    Allow from all
    Require all granted
</Directory>

and restart your apache2 server

The access control configuration changed in 2.4, and old configurations aren’t compatible without some changes. See here.

If your old config was Allow from all (no IP addresses blocked from accessing the service), then Require all granted is the new functional equivilent.

Leave a Reply

Your email address will not be published. Required fields are marked *