时间线

My Life My Style

Apache2.2.X版本支持PHP5的推荐解决办法

安装完apache后没出现问题,但和php构建使用时,启动apache出现这样的错误:httpd.exe: Syntax error on line 99 of C:/Apache2.2/conf/httpd.conf: Cannot load

C:/php/php5apache2.dll into server: The specified module could not be found."

Note the errors or messages above, and press the <ESC> key to exit.  25…

网上流传的解决办法是给Apache打补丁:

===================================

下载:
http://blog.haloso.com/attachments/200606/01_034408_php5apache2.dllphp5.1.x.rar

并解压.共有三个文件.
vcredist_x86.exe
php5apache2.dll
httpd.exe.manifest

1.将 php5apache2.dll 覆盖掉你原来PHP目录下的 php5apache2.dll 文件.
2.将 httpd.exe.manifest 文件复制到你的apache安装目录下的bin文件夹下.
3.双击运行vcredist_x86.exe安装.(如果您的系统里已安装了 .NET framework 2.就可以省掉这一步)
然后重启你的apache2.2

===================================

在使用一段时间发现以上打补丁的方法总是出问题,所以找到了一个更好的解决方法,不用下载上面说到的那个压缩包。

首先我们先解释一下这个我们原来在httpd.conf中添加的这段指令:
LoadModule php5_module "c:/php/php5apache2.dll"

其中的php5apache2.dll是apache2.0.x的模块,而不是apache2.x的模块。php目录中还有一个文件php5apache2_2.dll是apache2.2.x的模块,所以如果我们应用php时使用apache2.2作为服务器,我们应该将这个指令改为:
LoadModule php5_module "c:/php/php5apache2_2.dll"

但如果使用apache2.0.x作为服务器,这个指令则不用改动。

只需改动一下便可以使上面那个错误提示消失,而且运行稳定无问题。

发表评论

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Connecting to %s

加关注

Get every new post delivered to your Inbox.