Error 403 Forbidden |localhost | in Ubuntu i do not come enter to index.php

7,444

Solution 1

Sounds like a permissions error. Try sudo chmod -R 775 on the directory in question. (Preferably where the site's root folder is).

As well, use sudo nano /etc/apache2/sites-available/000-default.conf to open nano and enter this at the bottom of the file (keep in mind that [folder name] is your root folder for the site.

<Directory [folder name]> AllowOverride All </Directory>

Solution 2

I would check permissions, but also your configuration settings in apache.

There were a couple changes in how to allow permissions to your directory or project, which if the project was started under apache2.2 it would take some updating.

Apache Upgrade Guide

To sum up one of the big gotchas: (quoted from linked site, emphasis added)

Here are some examples of old and new ways to do the same access control.

In this example, there is no authentication and all requests are denied.

2.2 configuration:

Order deny,allow
Deny from all

2.4 configuration:

Require all denied

In this example, there is no authentication and all requests are allowed.

2.2 configuration:

Order allow,deny
Allow from all

2.4 configuration:

Require all granted

Check those out as well as your directory permissions (making sure your web server user can access all directories in the path to this folder).

Share:
7,444

Related videos on Youtube

simon
Author by

simon

Hello everyone I am a simple Software Developer

Updated on September 18, 2022

Comments

  • simon
    simon over 1 year

    I have this project in PHP. The whole project is fine except when I browse to index.php on localhost, it me sends this error?

    Forbidden Error

    • Manos Kounelakis
      Manos Kounelakis almost 7 years
      check file permissions for every folder/file in your project
    • ben-Nabiy Derush
      ben-Nabiy Derush almost 7 years
      Does this happen only for this site, or for any page you try to put up? It sounds like your setup might be for apache2.2 and not updated to 2.4 yet, meaning that its config files or settings in apache might not have the right syntax, like Require all granted ...