首先PHP5.5.12要下载线程安全的版本。因为不安全的版本里面没有php5apache2_4.dll这个文件。
其次就是apache的服务器版本要从apache下载地址下载,具体的原因官方原文如下:
Please use the Apache builds provided byApache Lounge. They also provide VC11 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs.
If you are using PHP with Apache 1 or Apache2 from apache.org (not recommended) you need to use the older VC6 versions of PHP compiled with the legacy Visual Studio 6 compiler. Do NOTuse VC9+ versions of PHP with the apache.org binaries.
With Apache you have to use the Thread Safe (TS) versions of PHP.
下载好后把所有的文件解压到同一文件夹中,首先配置apache:
1.ServerRoot "E:/WAMP/Apache";apache的解压地址
2.Listen 80:如果有IIS建议改成其他端口如8080
3.ServerAdmin example@gmail.com :输入一个邮箱地址
4.ServerName www.example.com:80:端口要和上面一致
5.<Directory />
AllowOverride none
Require all denied
</Directory>
6.DocumentRoot "E:/WAMP/WWW"
<Directory "E:/WAMP/WWW">:设置网页的主要目录
7.LoadModule php5_module "E:/WAMP/PHP/php5apache2_4.dll"
PHPIniDir "E:/WAMP/PHP"
AddType application/x-httpd-php .php .html .htm
8.加入主要的识别文件类型 DirectoryIndex ndex.html index.htm index.php
然后用管理员cmd运行bin下的httpd.exe 安装httpd.exe -k install -n "Apache24"