繁体   English   中英

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

[英]Xampp - Ubuntu - cant access my project in lampp/htdocs

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

当我输入浏览器localhost/soap/php (soap / 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. 如果您安装了sublime文本,只需输入:

subl httpd.conf

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

 <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 

我希望它会帮助你..

一个可能的原因是您正在使用虚拟主机。

在这种情况下,请在终端中使用此命令

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

然后在文件末尾添加此代码块

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

最后重启XAMPP

sudo /opt/lampp/lampp restart

我已经给了所有权限,仍然收到错误消息。 转到 - > /etc/apache2/sites-available/000-default.conf设置:DocumentRoot到/ opt / lampp / htdocs

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

它会很有用,

  0 -> No permission
  1 -> Execute
  2 -> Write
  3 -> write and execute(2 +1)
  4 -> Read
  5 -> Read and execute
  6 -> Read and write
  7 -> read,write and execute
  Then What about three decimal 

  1st-digit Owner

  2nd- digit Group

  3rd- digit Others

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 with full

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM