Xampp – Ubuntu的 – 无法访问我的项目在lampp / htdocs

我已经安装xamppUbuntu 12.04。 我把我的项目放在文件夹/ opt / lampp / htdocs / project_is_here中

当我在浏览器中inputlocalhost/soap/php (肥皂/ PHP是在我的htdocs文件夹)这是index.php我得到以下错误:

 Access forbidden! You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. If you think this is a server error, please contact the webmaster. Error 403 localhost Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7 

任何想法如何解决这一问题? 我认为这是放置该项目的正确地点,因为我试过其他地方,它说位置不存在,这个错误消失在这里,我得到这个。

有任何想法吗?

  1. 在linux终端导航到您的lampp目录。

     cd /opt/lampp 
  2. 在命令行中输入:

     sudo chmod 777 -R htdocs 

这个问题应该解决。

第一编辑:

你刚才做的是:

您导航到包含受保护的目录的目录。 你的问题是,这是一个受到系统访问保护的文件夹。 当您命令chmod 777 -R htdocs时,您所做的是为您的计算机上的每个人设置读取/写入/执行允许的权限。

现在,你知道每个数字的含义。 它说这个数字是关于谁的。 现在从0到7的每个数字都设置了一个权限级别。 我只是简单地为你提供一个链接。

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

我忘了补充为什么有一个“-R”。 '-R'使命令递归并影响htdocs以及htdocs的所有子目录及其所有子目录等。

我遇到了同样的问题,这是我的解决方案:


在终端

 cd /opt/lampp/etc/ 
  1. 如果你有崇高的文字安装只需输入:

subl httpd.conf

3.当配置文件在崇高打开时,你必须检查这三个块是否如下:

 <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 

例如 :

我的用户名是mhmd,我的组名也是mhmd

 User mhmd Group mhmd 

我希望它能帮助你

我已经给了所有的许可,仍然有错误信息。 转到 – > /etc/apache2/sites-available/000-default.conf将DocumentRoot设置为/ opt / lampp / htdocs

所有解决了我。 将“DocumentRoot”更改为您的项目所在的文件夹。

它会有用的,

 test@test:~$ sudo chown -R test:test /var/www/html/folder test@test:~$ sudo chmod -R 666 /var/www/html/folder //-system user test@test:~$ sudo chmod -R 777 /var/www/html/folder // -browser 

这是什么777? – > 7:你,7:我们,7:他们。