安装配置apache+php的问题集(1)

 Cannot load C:/php/php5apache2.dll into server: 的解决办法

今天下了一个最近版的Apache:apache_2.2.11-win32-x86-openssl-0.9.8i.msi
然后下载了php-5.2.9-2-Win32.zip,
Apache装完了测试都正常,PHP配置以后出线标题上的问题,在网上查了一下,找个一个简单的解决方案:
把默认的加载换成php5apache2_2.dll就可以了
LoadModule php5_module "C:/php/php5apache2_2.dll"

错误 403/you don't have the permission to access on this server
解决方法:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

其中“Deny from all”改为“Allow from all”,这样就可以了。

 

部分总结如下:

根据你自己的php版本,

如果是php5.1,应该就应该加载php5apache.dll

如果是php5.2,应该就应该加载php5apache2.dll

如果是php5.2.2,应该就应该加载php5apache2_2.dll

HTTP 错误 403 - 禁止访问
Internet Explorer

于是,去查看error.log,发现有下面的内容:
[Wed Aug 20 18:59:38 2008] [error] [client 58.154.234.56] client denied by server configuration: D:/Program Files/Apache Software Foundation/Apache2.2/cgi-binhello.cgi
[Wed Aug 20 18:59:38 2008] [error] [client 58.154.234.56] client denied by server configuration: D:/Program Files/Apache Software Foundation/Apache2.2/cgi-binhello.cgi
想想应该是路径的关系,因为正常情况下,hello.cgi的路径应该是:
D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/hello.cgi
难道是httpd.conf中的路径设置有问题?可是昨天,就是那样的也没有关系啊.不管了,先改下试试,打开httpd.conf可以看到:
#
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client. The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias
.
    #
    ScriptAlias /cgi-bin/ "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin"
</IfModule>
#
# "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
注意上面的红色字体部分,它里面有说可能要加"/"的,那么我们就把路径变得更完整些吧.那么,可以将上面的内容更改如下,主要是蓝色字体部分后面加上一个"/".就是改为如下:
ScriptAlias /cgi-bin/ "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>
#
# "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
更改之后,保存httpd.conf,另外要关闭Apache Http Server服务(注意:必须确定Apache Http Server已经关闭!),就是关闭Start Apache in Console那个类似命令提示符的窗口.然后,在浏览器试着访问Apache Http Server服务,看看是不是真的关闭了.就是访问: http://58.154.234.56:8080 ,看看是不是不能打开静态网页. 如果能访问静态网页,说明Apache Http Server服务还没有彻底关闭,所以此时最好等待一会.然后再次尝试,直到访问http://58.154.234.56:8080时出现如下
上面说明Apache Http Server已经彻底关闭了. 然后我们重新打开Start Apache in Console.看看在浏览器中是否能够访问静态网页. 如果能访问,就会出现:
It works!
这是Apache默认的主页的内容.
然后,让我们再次打开hello.cgi,看看是不是能访问了. 输入:http://58.154.234.56:8080/cgi-bin/hello.cgi,然后就会出现:
Hello,World!
这个说明,我们的Apache Http Server又能访问cgi程序了.
这个就是解决Windows下的Apache Http Server在打开cgi程序时出现HTTP403(禁止访问)的办法.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值