1.安装好默认的apache服务器
2.将php的zip包解压缩到c:\php,并将这个目录加入path的环境变量
3.修改httpd.conf,加入
#================================================================
# For PHP 5 do something like this:
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
#================================================================
5.将c:\php目录下的php.ini-dist改名为php.ini
如果想支持php读取mysql,将php.ini中下面的注释去掉
;extension=php_msql.dll
6.如想改变www路径,修改
DocumentRoot "C:/www";这个是非虚拟主机的配置方法
<Directory "C:/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
7.如果想修改默认主页,修改
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
8.测试php代码
<?php
echo "HelloWorld!<br>";
phpinfo();
?>