Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Xampp-Ubuntu-无法访问lampp/htdocs中的我的项目_Php_Ubuntu_Xampp - Fatal编程技术网

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

Php Xampp-Ubuntu-无法访问lampp/htdocs中的我的项目,php,ubuntu,xampp,Php,Ubuntu,Xampp,我已经在Ubuntu 12.04上安装了xampp。我已经把我的项目放在这里的/opt/lampp/htdocs/project\u文件夹中 当我在浏览器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 docu

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

当我在浏览器
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
有没有办法解决这个问题?我认为这是放置项目的正确位置,因为我尝试了其他地方,它说位置不存在,这个错误在这里消失了,我得到了这个

有什么想法吗

  • 在linux终端中,导航到LAMP目录

    cd /opt/lampp
    
  • 在命令行类型中:

    sudo chmod 777 -R htdocs
    
  • 这个问题应该解决

    第一次编辑:

    你刚才做的是:

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

    现在,你知道每个数字的意思了。上面写着这个号码是关于谁的。现在,0-7之间的每个数字都设置了权限级别。我将为您提供一个链接


    我忘了加上为什么有一个'-R'-R'使命令递归,并将影响htdocs以及htdocs的所有子目录和这些子目录的所有子目录等。

    我经历过同样的问题,这是我的解决方案:


    1.在候机楼

  • 如果安装了sublime text,只需键入:
  • subl httpd.conf

    3.在升华中打开配置文件时,必须检查这三个块是否如下所示:

    例如:

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

    我希望这会对你有所帮助

    这会有用的

      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:他们

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

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

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

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

    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>
    

    777和666是文件权限,777=对权限没有限制。任何人都可以做任何事。一般来说,这不是一个理想的环境。666=所有用户都可以读写该文件。使用:sudo chmod-R+w/var/www/html/folderThank..@Hoang Trinh您可以及时保存我的文件。谢谢这对我有用。我知道这与我使用虚拟主机有关,但没有想到用谷歌(我的查询)搜索虚拟主机。
    User your username
    Group your group name
    
    User mhmd
    Group mhmd
    
      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
    
    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>
    
    sudo /opt/lampp/lampp restart