0
votes

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.

2
the apache conf link is not workingJoshKisb
0755 directories, 0644 files.. you got them round the wrong way. also apache user should own the files.. www-data not your user unless you have added it to www-data group. fixing permissions is the quickest way to break it.Lawrence Cherone

2 Answers

0
votes

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/-)

0
votes

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.