先学习下手动安装,能手动了才能自己掌控
1,下载,httpd-2.2.31-x86-r4.zip(先用老的版本,这个xp能用的,以后更新再说,现在已能用为主)
2,解压到一个目录比如(D:/webTools),进入目录
httpd -k install
3,本地服务会显示Apache2.2 状态应该还没有,显示状态,可以自己启动这个服务。在安装目录下有个\bin\ApacheMonitor.exe,直接用这个软件可以方便开启,关闭,重启服务,只要服务能启动就说明ok了
4,一些apache的必要设置。应该是conf文件夹中的httpd.conf这个文件中 查找Document ,有这样一段 DocumentRoot “/Apache22/htdocs”,在DocumentRoot前面加个#号,把这个默认的地址禁用掉,我们要用自己设置的根目录D:/wenRoot。
4-1, 还有查找Listen 80,去掉前面的#号,打开80端口是必须的。
还是在这个httpd.conf文件中查找
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
把Include conf/extra/httpd-vhosts.conf前面的#号去掉,开启虚拟主机。
5,首先host文件有这些
127.0.0.1 localhost
127.0.0.1 www.abced.com
然后进入这个文件httpd-vhosts.conf,添加如下:
<VirtualHost *:80>
DocumentRoot "D:/webRoot"
ServerName localhost
DirectoryIndex index.html index.htm index.php
<Directory />
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ErrorLog "D:/webRoot/error.log"
CustomLog "D:/webRoot/access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/Html5/Mypage"
ServerName www.abced.com
DirectoryIndex abced.html index.html index.htm index.php
<Directory />
Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
那么地址栏打入localhost或者www.abcde.com可以进入你设定的文件夹的默认主页了。
到这里虚拟主机设置完成了,可以随便写个页面测试下。
下面手动安装php了.php-5.3.5-Win32-VC6-x86.zip。
1,解压D:/webTool/php
2,进入apache的目录在httpf.conf文件中,添加如下代码
LoadModule php5_module D:/webTool/php/php5apache2_2.dll
pHpiniDir "D:/webTool/php"
AddType application/x-httpd-php .php .phtml
3,在php目录将php.ini.development改成php.ini
4,在php.ini指定功能模块,打开php.ini查找extension_dir,会找到extension_dir=“ext”,改为
你自己的目录
并去掉前面的;号(分好),这样就开启了
extension_dir = "D:/webTool/php/ext"
5,测试下是否成功,在D:/wenroot建立一个index.php,
<?php
phpinfo();
?>
地址输入localhost能正常开打这个index.php,并显示正常,说明安装成功了。