1. 安装apache
APACHE安装目录
ServerRoot "E:/work/java/Apache2.2"
配置监听端口
Listen 8080
配置# Virtual Hosts 此处的端口与监听的端口一置
NameVirtualHost *:8080
ServerAdmin
DocumentRoot "E:/work/java/www/" //WEB目录
ServerName 127.0.0.1:8080
ServerAlias 127.0.0.1:8080
ErrorLog logs/a.log //日志。 位置APACHE安装目录的LOGS下
CustomLog logs/a.log common
设置ServerName localhost:8080 如果其它IP请修改
设置DocumentRoot "E:/work/java/www/" //WEB目录
下面的位置也修改
#
# 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
#
# 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
改成
#
# 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
#
# 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
设置
DirectoryIndex index.html index.htm
增加php
DirectoryIndex index.php index.html index.htm
增加模块
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php-source .phps
2。PHP设置
解压或安装PHP。 本人用解压版本 5.2.10
register_globals = On 设置为ON。 //作用未深入研究
upload_max_filesize = 200M 上传文件限制。 默认2M //未作详细测试其用途
开启要加载的DLL模块
extension=php_curl.dll
extension=php_dbase.dll
extension=php_gd2.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_sockets.dll
设置环境变量PHPRC指向PHP.INI文件 E:\work\java\php5.2.10\php.ini
设置环境变量PATH。 加上PHP的安装目录。E:\work\java\php5.2.10;E:\work\java\php5.2.10\ext;
/// 环境变量放在PATH前面。 如果放在后面。可能出现PHP Warning: PHP Startup: Unable to load dynamic library
加载不到DLL的错误。
配置APACHE解析PHP
设置LoadModule加载PHP LoadModule php5_module E:/work/java/php5.2.10/php5apache2_2.dll
其它版本PHP原样修改 如果目录有空格需要用''引号括起来.如:
LoadModule php5_module 'C:/Program Files (x86)/Apache Software Foundation/php5.2.10/php5apache2_2.dll'
写一个测试程序如下,保存为index.php文件PHP Installation Test
在Loaded Configuration File 项查看加载的PHP.INI文件. 如果上面设置的PHPRC环境变量不起作用就把PHP.INI文件复制到APACHE的根目录下.