PHP环境配置中遇到的各种问题解决方法: Cannot load php5apache2_2.dll into server

我所用的环境和版本:

Windows XP

httpd-2.2.22-win32-x86-no_ssl.msi

php-5.2.17-Win32-VC6-x86.msi  (选择模块:Apache 2.2.x Module)



Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.22-win32-x86-no_ssl.msi [PGP] [MD5] [SHA1]

下载地址:http://httpd.apache.org/download.cgi



VC6 x86 Thread Safe (2011-Mar-22 13:29:30)

Installer [20.41MB]
sha1: 710a69733aa280f22c86e8b868c51f5796f0a390

下载地址:http://windows.php.net/download/



解决日期:2012-1-12 11:13:47


问题1:

启动不了Apache,没有安装服务。

解决:到cmd命令行:敲入

e:

cd E:\php\soft\Apache2.2\bin

httpd.exe -k install

httpd.exe -k start


问题2:

启动服务是报错: Windows 不能在 本地计算机启动 Apache2.2。有关更多信息,查阅系统事件日志

the requested operation has failed

Cannot load E:/php5apache2_2.dll into server


起初以为是8080端口被占用

先用命令行,查找占用端口的进程号PID

netstat -an -p tcp -o

结果没有找到对应的进程


后来就进入E:\php\soft\Apache2.2\conf\httpd.conf,修改段括号为8081

Listen 8081

但是还是不行。



今天早上又一次配置了PHP环境,几乎每次配置都会遇到问题,下面就是解决方法:


打开:E:\php\soft\Apache2.2\conf\httpd.conf

光标跳到最下面内容为:


#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir ""
LoadModule php5_module "php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL


E:\php\soft\Apache2.2\bin>httpd.exe -k start

httpd.exe: Syntax error on line 495 of E:/php/soft/Apache2.2/conf/httpd.conf:Cannot load E:/php5apache2_2.dll into server: \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3


若修改为:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "E:/php/soft/PHP"
LoadModule php5_module "/php5apache2_2.dll"
AddType application/x-httpd-php .php
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL


E:\php\soft\Apache2.2\bin>httpd.exe -k start
httpd.exe: Syntax error on line 495 of E:/php/soft/Apache2.2/conf/httpd.conf: Cannot load E:/php/soft/Apache2.2/php5apache2_2.dll into server:

 \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3


一看才知道问题出在哪里,原来/php5apache2_2.dll这句,Apache以为DLL是在自己的目录下了,和高上的E:/php/soft/PHP/无关,所以要用绝对路径:

修改为:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "E:/php/soft/PHP/"
LoadModule php5_module "E:/php/soft/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL


重启

E:\php\soft\Apache2.2\bin>httpd.exe -k start
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.101 for ServerName

哇塞,居然服务器启动了,泪流满面啊!!!~~

还有解一个小问题无关大碍,解决办法:只要把/conf/httpd.conf文件的#ServerName 前的#去掉,然后重启下服务就好了。


PHP测试页面:

E:\php\soft\Apache2.2\htdocs\test.php

内容:


你可能感兴趣的:(php)