Configure integration WIN APACHE PHP MYSQL TCOMCAT (or RESIN) full manual
Author: zhengyong
System Requirements:
Hardware can run the operating system
Win2K, WinXP or Win2003 operating system
Preparation:
Software list: (This is complete, the following software version is complete)
1, apache_2.0.47-win32-x86-no_ssl (Apache Web Server)
2, PHP-4.3.3-Win32 (PHP language parser)
3, MySQL-4.0.12-Win (mysql database)
4, J2SDK-1_4_2-Windows-I586 (Java Language Environment)
5, JAKARTA-TOMCAT-5.0.9 (Tomcat JSP Analysis Server)
6, Resin-3.0.3 (RESIN JSP Analysis Server)
7, MOD_JK_1.2.5_2.0.47.dll (Integrated Apache Tomcat Plus)
8, mm.mysql-2.0.4-bin.jar (JSP Access connection mysql file)
start installation:
First, APAHCE PHP MySQL installation configuration
1. Install apache_2.0.0.47-win32-x86-no_ssl, the program default installation path is: c: / apache2 / program files / apache group /, you need to make its installation path to: C: /
(You can also do it, mainly for modifying the configuration for modification).
2. After the installation is complete, the Apache service is automatically loaded, then open the browser, browse: http: // localhost, appear Apache Welcome page (this step needs to put the file in the C: / Apache2 / HTDOCS directory "index.html.en "Change to" index.html ", can display); if this step is abnormal, please check the installation source file, reinstall.
3. Install the PHP-4.3.3-win32, the general downloaded PHP file is a free-installed compressed package, unzipped to C: / PHP.
4. Configure PHP and Apache to resolve the PHP program. PHP configuration: Remove "php.ini-dist" in the C: / PHP / directory "php.ini" and copy it to the C: / Windows / System32 (Win2K directory: C: / Winnt / System32) Apache configuration: C: /APAHCE2/CONF/HTTPD.CONF
HTTPD.CONF D At this configuration file last adds the following statement to support PHP program: scriptalias / php / "c: / php /" addtype application / x-httpd-php .php3 address / x-httpd-php .php AddType Application / X-httpd-php .phtml action application / x-httpd-php "/ php/Php.exe "5. Restart the Apache server, write the following statement with the editor:
Phpinfo ();?>
Save the file name "Test.php" to the C: / Apache2 / HTDOCS directory, then open the browser, browse: http://localhost/test.php, the basic information of PHP will explain the configuration. Strictly follow the above to explain the installation configuration, will succeed once.
6. Install MySQL-4.0.12-win, press "Next" to install successfully, then execute "winmysqladmin.exe" in the c: / mysql / bin directory, the initial information of MySQL appears, indicating successful installation.
7. PHP even slightly this, there is no problem.
He you can take a break here, ready for the following long processes ...
Second, install JDK and Tomcat
1. Install the J2SDK-1_4_2-Windows-i586, JDK must be installed before Tomcat and Resin, the default installation path can be installed.
2. Install Jakarta-Tomcat-5.0.9, the default installation path can be installed.
3. Copy mm.mysql-2.0.4-bin.jar files to C: /J2SDK1.4.2/Lib and C: / Tomcat 5.0 / Common / LIB
4. Set an environment variable (desktop -> My Computer -> Right click -> Select "Properties" -> Advanced -> Environment Variables), all settings are in the system variable bar. New -> Variable Name: Java_Home -> Variable: C: /J2SDK1.4.2 New -> Variable Name: Tomcat_Home -> Variable: C: / Tomcat 5.0 New -> Variable Name: Path -> Variable:.;; : /j2sdk1.4.2/bin; (previous ".;" Be sure to have) Modify the increase Environment variable ClassPath (if there is no change name, new) -> Add variable value:.; c: /j2sdk1.4.2/lib /dt.jar;c:/J2SDK1.4.2/lib/tool.jar;
C: /j2sdk1.4.2/lib/netcomponents.jar;
C: /j2sdk1.4.2/lib/mm.mysql-2.0.4-bin.jar;
C: / Tomcat 5.0 / Common / Classes;
C: / Tomcat 5.0 / Common / LIB;
C: / Tomcat 5.0 / Common / lib / servlet-api.jar;
(In front "." "" Must have)
5. Start the Tomcat server, open the browser, browse: http: // localhost: 8080 /, the Tomcat Welcome page; if this step appears, check the installation source file, reinstall.
Third, integrated Apache Tomcat server
1. Copy the MOD_JK_1.2.5_2.0.47.dll file to the C: / Apache2 / Modules directory. 2. Apache configuration: c: /apahce2/conf/httpd.conf
HTTPD.CONF At this configuation file, add the following statement to support JSP programs: loadModule JK_Module Modules / Mod_jk_1.2.5_2.0.47.dll jkworkersfile "C: / Tomcat 5.0 / conf / workers.properties" jkmount / servlet / * ajp13 JKMount /*.jsp Ajp13
3. View if the port "8009" is commented in the C: / Tomcat 5.0 / conf / server.xml file, if it is consistent with my version, don't modify it.
4. In the C: / Tomcat 5.0 / conf / directory, the new file name "workers.properties" will be created as follows to the new files in Workers.properties.
Workers.properties # only copy the following: # This is currently modified by the installation directory to modify workers.tomcat_home = c: / tomcat 5.0 workers.java_home = c: /j2sdk1.4.1_01 ps = / # worker.list = ajp13 worker. list = ajp12, ajp13 worker.ajp12.port = 8007 worker.ajp12.host = localhost worker.ajp12.type = ajp12 worker.ajp12.lbfactor = 1 worker.ajp13.port = 8009 worker.ajp13.host = localhost worker.ajp13 .type = ajp13 worker.ajp13.lbfactor = 1 worker.loadbalancer.type = lb worker.loadbalancer.balanced_workers = ajp12, ajp13 worker.inprocess.type = jni worker.inprocess.class_path = $ (workers.tomcat_home) $ (ps) Classes worker.inprocess.class_path = $ (workers.tomcat_home) $ (ps) lib $ (ps) jaxp.jar worker.inprocess.class_path = $ (worker.tomcat_home) $ (ps) lib $ (ps) Parser.jar worker .inprocess.class_path = $ (workers.tomcat_home) $ (PS) Common $ (PS) lib $ (ps) jasper.jar worker.inprocess.class_path = $ (workers.tomcat_home) $ (ps) Common $ (ps) lib $ (ps) servlet.jar worker.inprocess.class_path = $ (workers.tomcat_home) $ (ps) Common $ (ps) lib $ (ps) Webserver.jar worker. inprocess.class_path = $ (workers.java_home) $ (ps) lib $ (ps) tools.jar worker.inprocess.cmd_line = -config worker.inprocess.cmd_line = $ (workers.tomcat_home) /conf/jni_server.xml worker. InProcess.cmd_Line = -Home worker.inprocess.cmd_line = $ (worker.tomcat_home) worker.inprocess.jvm_lib = $ (workers.java_home) $ (PS) JRE $ (PS) BIN $ (PS) Classic $ (PS) JVM .dll worker.inprocess.stdout = $ (workers.tomcat_home) $ (ps) inprocess.stdout worker.inprocess.stderr = $ (workers.tomcat_home) $ (ps) inprocess.stderr worker.inprocess.sysprops = tomcat.home = $ (worker.tomcat_home)
5. Come to this apache and tomcat, restart the Apache and Tomcat servers, write with the editor as follows: <% @ Page ContentType = "text / html; charset = GB2312"%> <%? String msg = "this is jsp Test! See this passage, congratulations, success! ";?? Out.print (" Hello World! ");%> <% = msg%> The current date and time is <% = new java.util .Date ()%> <%? String str = "Using TRIM () And Substring () can be very useful";? Out.println (str);%>
Save the file name "Test.jsp" to the C: / Tomcat 5.0 / WebApps / root directory, then open the browser, browse: http: // localhost: 8080 / test.jsp, if normal, then change the address to: http: //localhost/test.jsp Displays the normal instructions. Strictly follow the above to explain the installation configuration, will succeed once.
Fourth, integrated apache Tomcat mysql
This step is relatively simple, but it is also the least easy to success, and the JSP's MySQL driver has been placed in the corresponding directory, and the environment variable is also set, so it is just whether the JSP can connect to the mysql database.
1. Test 1, write with the editor as follows:
<% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% java.sql.connection conn; java.lang.string strconn; class.forname ("org.gjt.mm.mysql.driver). Newinstance (); conn = java.sql.driverManager.getConnection ("JDBC: MySQL: // LocalHost / Test", "root", "");%>
Note: The database is here: TEST connection data inventory username is: the root password is empty. Modify according to your own database.
Save the file name "Test-mysql.jsp" to the C: / Tomcat 5.0 / WebApps / root directory, then open the browser, browse: http: // localhost: 8080 / test-mysql.jsp or http: // localhost / Test-mysql.jsp, after running, if the blank page is displayed, the connection database is successful, otherwise it is not successful, and it is gradually configured.
2. Test 2, write with the editor as follows:
<% @ Page ContentType = "Text / HTML; Charset = GBK"%> <% @ page language = "java" import = "java.sql. *"%> <% connection conn = null; class.forname ("ORG .gjt.mm.mysql.driver "). Newinstance (); conn = java.sql.driverManager.getConnection (" JDBC: MySQL: // LocalHost / Test "," root "," "); if (conn == null) {System.out.println ( "get Conn Error");} Statement stmt = conn.createStatement (); ResultSet RS_result = null;%> <% RS_result = stmt.executeQuery ( "select * from guestbook"); String Name; while (rs_result.next ()) {name = rs_result.getstring ("name");%> <% = Name%> <%} RS_RESULT.CLOSE (); stmt.close (); conn.close () ;%> Save the file name "Test-mysql2.jsp" to the C: / Tomcat 5.0 / WebApps / root directory, then open the browser, browse: http: // localhost: 8080 / test-mysql2.jsp or http: / /localhost/test-mysql2.jsp, after running.
V. Install RESIN, integrate Apache Resin
1. If you don't start the other JSP parsing server on the machine, if you start, please turn off the service.
2. Directly extract RESIN-3.0.3.zip to C: /
3. Use the command in character mode: c: /resin-3.0.3/bin/httpd -install to install Resin as a service of the system, then start the resin in the service. Delete service command: C: /RESIN-3.0. 3 / bin / httpd -remove
4. Open the browser, browse: http: // localhost: 8080, if there is RESIN information, the RESIN service has started.
5. Apache configuration: c: /apahce2/conf/httpd.conf
In this configuration httpd.conf file add the following statement: LoadModule caucho_module C: /resin-3.0.3/libexec/apache-2.0/mod_caucho.dll ResinConfigServer localhost 6802 SetHandler caucho-status AddHandler caucho-request jsp SetHandler caucho-request
Save and restart apache.
6. RESIN configuration: c: /RESIN-3.0.3/conf/RESIN.CONF
Resin.conf Modify the default directory, the red part is modified: c: / apache2 / htdocs ... After saving, restart the RESIN service, store the edited JSP file to the C: / Apache2 / htdocs directory, then open the browser Browse, you can freely bleak between PHP and JSP.