这里以我的安装目录为准
一、 conf / httpd.conf (apache 配置文件) httpd.conf 主要配置内容
1、增加一行 (该文件就是php解析引擎)
loadModule php5_module "d:/php5.2/php5apache2_2.dll"
2、增加一行 (解析php文件)
AddType application/x - httpd - php .php
3、增加一行
PHPIniDir "d:/php5.2"
二、 php.ini (php配置文件)
1.将 extension = php_mysql.dll 注视去掉 (把#号去掉)
2、将extension_dir = "./" 更改为
extension_dir = "d:/php5.2/ext"
3、如果配置虚拟主机
将注释 465行的 Include conf/extra/httpd-vhosts
三、虚拟主机配置
<virtualHost *:80>
ServerName www.demo.com #你的虚拟域名
DocumentRoot "你的虚拟主机目录" #如我的 D:/web
<Directory "你的虚拟主机目录" >
Allowoverride All
order allow , deny
Allow from all
</Directory>
</virtualHost>
//最后一步 配置虚拟主机
打开你的电脑 一般目录为 C:\Windows\System32\drivers\etc\hosts 文件编辑
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#这里增加一行
127.0.0.1 www.demo .com