您的位置:首页 > 运维架构 > Apache

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

2009-06-26 20:15 330 查看
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(禁止访问)的办法.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: