2004年11月17日

所需软件:
 Apache2.0.49 for Win32
 PHP4.3.9 fro Win32 Apache
jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip
jakarta-tomcat-5.0.28.zip
j2sdk-1_4_2_05-windows-i586-p.exe
按照默认安装Apache
解压缩PHP到C:\Program files\php目录下
 将php下的php4ts.dll和php\dlls\下的所有文件复制到c:\winnt\system32下
 将php下的php.ini-dist复制到c:\winnt\system32下并改名为php.ini
 打开php.ini
 找到extension_dir =修改为extension_dir = “C:\Program Files\PHP\extensions\”
 找到;extension=php_bz2.dll->;extension=php_zip.dll这段修改为
 extension=php_bz2.dll
 extension=php_cpdf.dll
 extension=php_crack.dll
 extension=php_curl.dll
 extension=php_db.dll
 extension=php_dba.dll
 extension=php_dbase.dll
 extension=php_dbx.dll
 extension=php_domxml.dll
 extension=php_exif.dll
 extension=php_fdf.dll
 extension=php_filepro.dll
 extension=php_gd2.dll
 extension=php_gettext.dll
 extension=php_hyperwave.dll
 extension=php_iconv.dll
 ;extension=php_ifx.dll
 ;extension=php_iisfunc.dll
 extension=php_imap.dll
 extension=php_interbase.dll
 extension=php_java.dll
 extension=php_ldap.dll
 extension=php_mbstring.dll
 ;extension=php_mcrypt.dll
 extension=php_mhash.dll
 extension=php_mime_magic.dll
 extension=php_ming.dll
 extension=php_mssql.dll
 extension=php_msql.dll
 ;extension=php_oci8.dll
 extension=php_openssl.dll
 ;extension=php_oracle.dll
 extension=php_pdf.dll
 extension=php_pgsql.dll
 ;extension=php_printer.dll
 extension=php_shmop.dll
 extension=php_snmp.dll
 extension=php_sockets.dll
 ;extension=php_sybase_ct.dll
 extension=php_w32api.dll
 extension=php_xmlrpc.dll
 extension=php_xslt.dll
 extension=php_yaz.dll
 extension=php_zip.dll
找到session.save_path改为session.save_path=C:\Program Files\php\tmp     \\SESSION存放路径
修改完成后,保存php.ini,到此完成PHP的安装和配置。


开始配置Apache
打开C:\Program Files\Apache Group\Apache2\conf\httpd.conf
 找到AddType application/x-tar .tgz在后面加入
  AddType application/x-httpd-php .phtml .pwml .php3 .php4 .php .php2 .inc
  AddType image/x-icon .ico
 找到#LoadModule ssl_module modules/mod_ssl.so在后面加入
  LoadModule php4_module “C:\Program Files\php\sapi\php4apache2.dll”  
找到AddDefaultCharset ISO-8859-1把它注掉      
 设置主页位置,找到DocumentRoot修改成你的叶子存放位置
 增加默认主页,找到DirectoryIndex 加入index.php index.php3 index.php4
 在DocumentRoot位置下建立一个index.php
  打开index.php输入<? phpinfo() ?>
重新启动Apache
打开127.0.0.1,如果能看到php信息,说明已经配好,Apache+php环境到此配置完成.

然后安装Tomcat
安装j2sdk-1_4_2_05-windows-i586-p.exe,默认安装
解压缩jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49,默认安装
解压缩jakarta-tomcat-5.0.28.zip到从c:\tomcat下
配置环境变量
名:CATALINA_BASE
值:c:\tomcat
名:CATALINA_HOME
值:c:\tomcat
名:CLASSPATH
值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet-api.jar;
名:JAVA_HOME
值:c:\j2sdk1.4.2_05

1,把modules\mod_jk2.so 复制到C:\Program Files\Apache Group\Apache2\modules下
2,打开C:\Program Files\Apache Group\Apache2\conf\httpd.conf找到LoadModule 在下面加入LoadModule jk2_module modules/mod_jk2.so
3,在C:\Program Files\Apache Group\Apache2\conf\新建一个workers2.properties,录入:
[shm]
file=${serverRoot}/logs/shm.file
size=1048576


# Define the communication channel
[channel.socket:localhost:8009]
#info=Ajp13 forwarding over socket
#tomcatId=localhost:8009
port=8009
host=127.0.0.1


#defint the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009


# Map the Tomcat examples webapp to the Web server uri space
[uri:/sky/*]
worker=ajp13:localhost:8009
#info=Map the whole webapp


4.打开C:\tomcat\conf\jk2.properties
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.


## COMMENTS WILL BE _LOST_


## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.


# Set the desired handler list
# handler.list=apr,request,channelJni
handler.list=apr,channelSocket,request
#
# Override the default port for the socketChannel
 channelSocket.port=8009
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config  is working
# shm.file=${jkHome}/work/jk2.shm


# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:


# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so


# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
然后在C:\tomcat\webapps\ROOT\下新建一个test.jsp 录入<% out.printnl(“test ok”);%>
就此配置完成
起tomcat,然后起apache
然后访问127.0.0.1/test.jsp完成