1.解压 php-5.2.5-Win32.zip 文件到 D:\PHP。
2.复制 D:\PHP 目录下的 php5ts.dll 文件到 C:\WINDOWS\system32 目录中。
3.复制 D:\PHP 目录下的 libmysql.dll 文件到 C:\WINDOWS\system32 目录中。
4.复制 D:\PHP\ext 目录下的 php_gd2.dll、php_mbstring.dll、php_mysql.dll 文件到 C:\WINDOWS\system32 目录中。
5.复制 D:\PHP 目录下的 php.ini-dist 文件到 C:\WINDOWS 目录中,改名为 php.ini。
注意:如果使用了NTFS文件系统,确保运行 webserver 的用户对 php.ini 有读取的权限(例如使其对 Everyone 可读)。
6.用记事本打开编辑php.ini文件,找到并修改下面两行:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
改成:
; Directory in which the loadable extensions (modules) reside.
extension_dir = "D:\PHP\ext"
再找到下面几行:
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
加上:
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
找到:
;date.timezone =
改成:
date.timezone = PRC
7.点击apache_2.2.8-win32-x86-no_ssl.msi安装Apache到D:\Apache。
8.编辑conf/httpd.conf文件:
[加载PHP5模块]
找到LoadModule段,在下面添加:
LoadModule php5_module "D:/PHP/php5apache2_2.dll"
[设置的默认文档]
找到:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改成:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
[设置MIME映射]
找到:
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
加上:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
[开启SSI支持]
找到:
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
改成:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
找到:
Options Indexes FollowSymLinks
改成:
Options Indexes FollowSymLinks Includes
[设置主目录]
找到:
DocumentRoot "D:/Apache/htdocs"
改成:
DocumentRoot "D:/wwwroot"
找到:
<Directory "D:/Apache/htdocs">
改成:
<Directory "D:/wwwroot">
9.编辑conf/httpd.conf文件创建虚拟目录:
找到:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
在下面添加:
Alias /phpmyadmin "D:/phpmyadmin"
<Directory "D:/phpmyadmin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<Directory "E:/wwwroot">
Order allow,deny
Allow from all
</Directory>
10.新建测试文件输入“<?echo phpinfo();?>”。