apache You don't have permission to access /test.php on this

2019-01-17 03:36:15王冬梅

===================================================
===================================================
解决Apache下403 Forbidden错误

正 文:

    今天在公司电脑上安装Apache,版本2.2.8,装完刚测试可以;配置了下php的php.in文件再次localhost打开发现错误:HTTP 错误 403 - 禁止访问,即403 Forbidden:You don't have permission to access / on this server.权限又不够了?

    马上打开apache的配置文件httpd.conf,逐行检查。在大约快一半的地方有以下这段代码:


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

发现了吧。由于配置了php后,这里的“Deny from all”已经拒绝了一切连接。把该行改成“allow from all”,修改后的代码如下,问题解决。


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    allow from all
</Directory>

再次在浏览器里打开http://localhost,显示it works!

总结:如果你也发生了这样的403禁止访问,不妨注意下apache的httpd.conf配置文件里有“Deny from all”这行的代码处,看看是不是哪里被系统悄悄地修改了。

您可能感兴趣的文章:

详解CentOS7安装配置Apache HTTP ServerApache2.4.x版wampserver本地php服务器如何让外网访问及启用.htaccessWin2003+apache+PHP+SqlServer2008 配置生产环境Ubuntu Server 10.04修改Apache的默认目录的方法WampServer设置apache伪静态出现404 not found及You don''t have permission to access / on this server解决方法分析Apache中启用Server Status配置示例Moon_LServer Linux下一键搭建Apache+PHP+MySQL+Zend+PHPMyAdmin+GD库的软件Apache实现Web Server负载均衡详解(不考虑Session版)WampServer下安装多个版本的PHP、mysql、apache图文教程Linux下Apache HTTP Server 2.4.26安装教程