1.到php官方网站下载php,我下载的文件名是php-5.4.3-Win32-VC9-x86.zip
解压到D盘的根目录,并改名为 d:\php 把 “d:\php”和“D:\php\ext”设置为环境变量
把 php.ini-development 拷贝一份并命名为 php.ini 并做如下修改:
doc_root ="D:/Program Files/CollabNet/Subversion Server/httpd/htdocs"
extension_dir = "D:/PHP/ext/"
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
extension=php_shmop.dll
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll
;extension=php_soap.dll
extension=php_sockets.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
;extension=php_zip.dll
做完配置之后在控制台用 php -v 和php -m来测试有无配置错误
2.配置apache,
在httpd.conf中添加如下行:
LoadModule php5_module "d:/php/php5apache2_2.dll"
phpinidir d:\php\php.ini
AddType application/x-httpd-php .php
AddType application/x-httpd-php .htm
并修改index内容如下:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
重启apache,在主目录中放置测试页面 test.php
<html>
<head><title>test</title></head>
<body>
<?php
phpinfo();
?>
</body>
</html>