Xampp - Ubuntu - cant access my project in lampp/htdocs

  1. In the linux terminal navigate to your lampp directory.

     cd /opt/lampp
    
  2. In the command line type:

     sudo chmod 777 -R htdocs
    

The problem should be solved.

What you just did was:

Navigate to the directory containing the protected directory. Your problem was that it was a folder that was access protected by your system. When you commanded chmod 777 -R htdocs, you set the permissions for every user on your computer to "read/write/execute - allowed".

Each number from 0-7 sets a permission level. Here's a link explaining that in more detail.

http://www.pageresource.com/cgirec/chmod.htm

The '-R' makes the command recursive and will affect htdocs as well as all subdirectories of htdocs and all subdirectories of those etc.


One possible reason is that you are using Virtual host.

In that case, use this command in your terminal

sudo nano /opt/lampp/etc/extra/httpd-vhosts.conf

Then add this block of code at the end of the file

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs"
    ServerName localhost
    ServerAlias localhost
    ErrorLog "logs/localhost-error_log"
    CustomLog "logs/localhost-access_log" common
</VirtualHost>

Finally restart XAMPP

sudo /opt/lampp/lampp restart

i've experinced the same problem and this is my solution :


1.in the terminal

cd /opt/lampp/etc/
  1. if you have sublime text installed simply just type :

subl httpd.conf

3.when the configuration file opened in sublime you have to check if these three blocks are as follow :

<Directory />
    AllowOverride All
    Require all granted
</Directory>

================================

<Directory "/opt/lampp/htdocs">
 Options Indexes FollowSymLinks ExecCGI Includes
 AllowOverride All
 Require all granted
</Directory>

================================

User your username
Group your group name

for example :

my username is mhmd also my group name is mhmd

User mhmd
Group mhmd

and i hope it will help you ..

Tags:

Php

Xampp

Ubuntu