当前位置:Gxlcms > PHP教程 > PHP错误:ForbiddenYoudon'thavepermissiontoaccess/onthisserver

PHP错误:ForbiddenYoudon'thavepermissiontoaccess/onthisserver

时间:2021-07-01 10:21:17 帮助过:35人阅读

用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

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

人气教程排行