Tristan
Tristan

Reputation: 1

How to fix error 403 error php files

I'm running ubuntu 16.04 and installed LAMP this way:

Install Apache

sudo apt-get install apache2

Install MySQL

sudo apt-get install mysql-server

Install PHP

sudo apt-get install php7.0 libapache2-mod-php7.0

Restart Server

sudo /etc/init.d/apache2 restart

Check Apache

Working

Check PHP

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Working

Files structure:

/var/www/html/index.html > redirects to index.php /var/www/html/pages/index.php < this file is not working and all php files

The owner group is set to:

chown -R www-data:www-data /var/www

The folders permissions are 755. The index.php permssions is 644 This is my apache2.conf file: https://ghostbin.com/paste/wwhog

But when i go to: http://localhost/pages/index.php I get this 403 Forbidden error. It seems like i can't see php files.

Upvotes: 0

Views: 5126

Answers (2)

Jambul Jakhaia
Jambul Jakhaia

Reputation: 57

Here is some ways how to fix it.

  1. chmod files 644 and folders 755 (you have opposite side)
  2. check owner of folders and files and chown them correctly.
  3. Disable SELinux.

Checking error log file of Apache will give you more information about error.

Upvotes: 1

Oulalahakabu
Oulalahakabu

Reputation: 489

Try chown -R www-data:www-data /var/www, if you still get a 403, that means the problem is in apache2 conf, but i do not think.

I'll complete this response when i'll can see your apache's conf :) (apache2.conf & sites-enabled/000-default.conf -it should be the one you'are using in /var/www/html/-)

Upvotes: 0

Related Questions