1、安装apache 路径为:D:\software\apache_php\Apache2.2
2、解压php-5.3.10-Win32-VC9-x64 并更名为 php 路径为:D:\software\apache_php\php
安装apache
打开浏览器 localhost 显示
It works!
apache安装完成。
3、修改
httpd.conf
打开: D:\software\apache_php\Apache2.2\conf\httpd.conf
P179
DocumentRoot "D:/software/apache_php/Apache2.2/htdocs"
改为:DocumentRoot "D:/www"
P207 <Directory "D:/software/apache_php/Apache2.2/htdocs">
改为:<Directory "
D:/www
">
设置默认文档(可不设)
P242 DirectoryIndex index.html
改为:DirectoryIndex index.html index.php
P474 #Include conf/extra/httpd-manual.conf
(去#号)改为:Include conf/extra/httpd-manual.conf
P131 增加代码
#指定php的ini文件,该文件是对php的一些配置
PHPIniDir "D:/software/apache_php/php"
AddType application/x-httpd-php .php .phtml
#让apache载入php处理模块
LoadModule php5_module D:/software/apache_php/php/php5apache2_2.dll
P391 增加 AddType application/x-httpd-php .php
4、修改
httpd-vhosts.conf
打开 D:\software\apache_php\Apache2.2\conf\extra\httpd-vhosts.conf
P29 DocumentRoot "D:/software/apache_php/Apache2.2/docs/dummy-host.localhost"
改为:
DocumentRoot
“
D:/www
”
P38 DocumentRoot "D:/software/apache_php/Apache2.2/docs/dummy-host2.localhost"
改为: DocumentRoot “ D:/www ”
改为: DocumentRoot “ D:/www ”
5、修改 php.ini
打开
D:\software\apache_php\php
复制
php.ini-development 粘贴并更名为 php.ini
打开php.ini
P1008 ;date.timezone =
(去分号加参数)改为:date.timezone = PRC
P821 ; extension_dir = "ext"
(去分号改参数)改为: extension_dir = "D:/software/apache_php/php/ext"
P959-P976
;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_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
重启apache环境
6、编写php文件放入www文件夹下
<?php echo phpinfo() ?>
成功!
7、途中解答,如重启apache环境报错,这基本是因为第3步的增加代码有误
验证:
打开 D:\software\apache_php\Apache2.2\bin
点击空白处按shirft+右键
进入命令窗口,输入命令: httpd -t 回车
显示错误信息。
自己写的笔记,其实每个步骤都有截图的,但是太麻烦了,所以就没有放上来。