首頁  >  文章  >  後端開發  >  PHP錯誤:Forbidden 您沒有權限存取此伺服器上的 /

PHP錯誤:Forbidden 您沒有權限存取此伺服器上的 /

WBOY
WBOY原創
2016-07-25 09:12:181140瀏覽

用http://localhost/test.php进行的测试,没有发现问题,后来要在内网测试一下就要用IP地址进行那个访问了,如:http://10.10.50.195/test.php,就出现了这个问题。 修改一下php的配置文件httpd.conf。 在原有的位置文件中找到配置节:

  1. Options FollowSymLinks
  2. AllowOverride None
  3. Order deny,allow
  4. Deny from all
  5. Satisfy all
复制代码

修改成:

  1. Options FollowSymLinks
  2. AllowOverride None
  3. Order deny,allow
  4. # Deny from all
  5. Allow from all
  6. #允许所有访问
  7. Satisfy all
复制代码

还有:

  1. #
  2. # Possible values for the Options directive are "None", "All",
  3. # or any combination of:
  4. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  5. #
  6. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  7. # doesn't give it to you.
  8. #
  9. # The Options directive is both complicated and important. Please see
  10. # http://httpd.apache.org/docs/2.2/mod/core.html#options
  11. # for more information.
  12. #
  13. Options Indexes FollowSymLinks
  14. #
  15. # AllowOverride controls what directives may be placed in .htaccess files.
  16. # It can be "All", "None", or any combination of the keywords:
  17. # Options FileInfo AuthConfig Limit
  18. #
  19. AllowOverride all
  20. #
  21. # Controls who can get stuff from this server.
  22. #
  23. # onlineoffline tag - don't remove
  24. Order Deny,Allow
  25. Deny from all
  26. Allow from 127.0.0.1
复制代码

修改成:

  1. #
  2. # Possible values for the Options directive are "None", "All",
  3. # or any combination of:
  4. # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  5. #
  6. # Note that "MultiViews" must be named *explicitly* --- "Options All"
  7. # doesn't give it to you.
  8. #
  9. # The Options directive is both complicated and important. Please see
  10. # http://httpd.apache.org/docs/2.2/mod/core.html#options
  11. # for more information.
  12. #
  13. Options Indexes FollowSymLinks
  14. #
  15. # AllowOverride controls what directives may be placed in .htaccess files.
  16. # It can be "All", "None", or any combination of the keywords:
  17. # Options FileInfo AuthConfig Limit
  18. #
  19. AllowOverride all
  20. #
  21. # Controls who can get stuff from this server.
  22. #
  23. # onlineoffline tag - don't remove
  24. Order Deny,Allow
  25. # Deny from all
  26. # Allow from 127.0.0.1
  27. Allow from all
复制代码

然后保存,重启服务,再次访问时发现问题已解决了。



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn