Configuration integration Win + Apache + PHP + MySQL + Tcomcat (or Resin) full manual, read configuration integration Win + Apache + PHP + MySQL + Tcomcat (or Resin) full manual, System requirements: before the hardware can run the operating system, you can prepare for the Win2K, WinXP, or Win2003 Operating system: (the required software list is completed in the following configuration column) 1,
System requirements:
The hardware can start the operating system.
Win2K, WinXP, or Win2003 operating system
Preparations:
List of required software: (this configuration includes the following software versions)
1. APACHE_2.0.47-win32-x86-no_ssl (Apache web server)
2. PHP-4.3.3-Win32 (PHP parser)
3. MySQL-4.0.12-win (MySQL database)
4. J2sdk-1_4_2-windows-i586 (JAVA environment)
5. Jakarta-Tomcat-5.0.9 (Tomcat JSP parsing server)
6. Resin-3.0.3 (Resin JSP parsing server)
7. mod_jk_1.2.5_2.0.47.dll (integrating Apache + Tomcat plus)
8. mm. Mysql-2.0.4-bin.jar (JSP access to the MySQL file)
Start Installation:
1. Installation and configuration of Apahce + PHP + MySQL
1. Install APACHE_2.0.47-win32-x86-no_ssl, the default installation path of the program is: C: \ apache2 \ program files \ apache Group \, you need to change its installation path to: C :\
(You can also modify the configurations without modification ).
2. after the installation is complete, the apache service automatically loads the file. Open the browser and browse:. The apache welcome page appears. (in this step, change the file "index.html.en.pdf" in the C: \ apache2 \ htdocsdirectory to "index.html" for display ); if an exception occurs in this step, check the installation source file and reinstall it.
3. Install the PHP-4.3.3-Win32, the PHP file downloaded in general is a free installation of compressed package, unzip to C: \ PHP can be.
4. Configure PHP and Apache to parse the php program.
PHP configuration: set "PHP." in the C: \ php \ directory. ini-dist "is renamed" php. ini, and copy it to C: \ windows \ system32 (the Win2K directory is C: \ winnt \ system32)
Apache configuration:
C: \ apahce2 \ conf \ httpd. conf
Httpd. conf
D. Add the following statement at the end of the configuration file to support the php program:
ScriptAlias/php/"C:/PHP /"
AddType application/x-httpd-php. php3
AddType application/x-httpd-php. php
AddType application/x-httpd-php. phtml
Action application/x-httpd-php "/php/php.exe"
5. Restart the Apache server and write the following statement in the editor:
Phpinfo ();
?>
Save the file name as "test. php" to the C: \ apache2 \ htdocs Directory, open the browser, and browse. If the PHP basic information appears, the configuration is successful. The installation and configuration will be successful once according to the preceding instructions.
6. Install the MySQL-4.0.12-win, always Press "next" to install successfully, and then run "winmysqladmin.exe" in the C: \ mysql \ bin directory, the initial information of mysql appears, indicating that the installation is successful.
7. The PHP connection to MySQL is skipped here. Generally, there is no problem.
Now you can take a break and prepare for the following long process ......
II. Install JDK and Tomcat
1. Install j2sdk-1_4_2-windows-i586, JDK must be installed before Tomcat and Resin, the default installation path can be.
2. Install Jakarta-Tomcat-5.0.9, the default installation path is OK.
3. Copy the mm. Mysql-2.0.4-bin.jar file to C: \ j2sdk1.4.2 \ lib and C: \ Tomcat 5.0 \ common \ lib
4. Set the environment variables (desktop> My Computer> right-click and choose Properties> Advanced> environment variables). All the settings are in the system variables bar.
Create-> variable name: JAVA_HOME
-> Variable value: C: \ j2sdk1.4.2
Create-> variable name: TOMCAT_HOME
-> Variable value: C: \ Tomcat 5.0.
Create-> variable name: PATH
-> Variable value:.; C: \ j2sdk1.4.2 \ bin; (The preceding ".;" must exist)
Modify and add the environment variable CLASSPATH (if this variable name is not available, create a new one)
-> Add the 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;
(The preceding ".;" must exist)
5. Start the Tomcat server, open the browser, and browse: the Tomcat welcome page appears. If this step encounters an exception, check the installation source file and reinstall it.
III. Integrate Apache + Tomcat servers
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
Add the following statement at the end of the configuration file 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. Check whether the port "5.0" in the C: \ Tomcat 8009 \ conf \ server. xml file is commented out. If it is the same as my version, do not modify it.
4. In the C: \ Tomcat 5.0 \ conf \ directory, create a file named "workers. properties" and copy the following content to the workers. properties file.
Workers. properties
# Simply copy the following content:
# Modify the current directory according to the installation directory
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 = $ (workers. 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. worker _line =-config
Worker. inprocess. worker _line = $ (workers. worker at_home)/conf/jni_server.xml
Worker. inprocess. worker _line =-home
Worker. inprocess. worker _line = $ (workers. worker at_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 =$ (workers. tomcat_home)
5. Now Apache and Tomcat are integrated. Restart the Apache and Tomcat servers,
Write the following content in the editor:
<% @ Page contentType = "text/html; charset = gb2312" %>
HI-JSP experiment
<%
String Msg = "This is JSP test! Congratulations! ";
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 as "test. jsp "to the C: \ Tomcat 5.0 \ webapps \ ROOT directory, then open the browser, browse:, if the display is normal, then change the address to: show normal instructions that the configuration is successful. The installation and configuration will be successful once according to the preceding instructions.
4. Integrate Apache + Tomcat + MySQL
This step is relatively simple, but it is also the most difficult part to succeed. The MySQL driver of JSP has been put in the corresponding directory, and the environment variables are also set, therefore, we only test whether JSP can connect to the MySQL database.
1. Test 1. Write the following content in the editor:
<% @ 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: Here the database is: the user name for connecting to the data inventory with test is: the root password is blank. Modify your database accordingly.
Save the file name as "test-mysql.jsp" to the C: \ Tomcat 5.0 \ webapps \ ROOT directory, then open the browser, browse: or, after running, if it is displayed as a blank page, it means the database is connected successfully, otherwise, the connection is successful. Configure the connection again.
2. Test 2. Compile the following content in the editor:
<% @ 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;
%>
Test
<%
RS_result=stmt.exe cuteQuery ("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 as test-mysql2.jsp to the C: \ Tomcat 5.0 \ webapps \ ROOT directory, then open the browser, browse: or, after running.
5. Install Resin and integrate Apache + Resin
1. Assume that no other JSP parsing server is started on the server. If yes, disable this service.
2. Directly decompress resin-3.0.3.zip to C :\
3. Run the command: C: \ resin-3.0.3 \ bin \ httpd-install in character mode.
Install Resin as a system service and start Resin in the service.
Delete service command: C: \ resin-3.0.3 \ bin \ httpd-remove
4. Open the browser and browse: If the Resin information is displayed, the Resin service is started.
5. Apache configuration:
C: \ apahce2 \ conf \ httpd. conf
Httpd. conf
Add the following statement at the end of the configuration file:
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:
C: \ Apache2 \ htdocs
...
After saving the file, restart the Resin service, store the edited JSP file in the C: \ Apache2 \ htdocs directory, and open the browser to view the file. Then, you can freely jump between PHP and JSP.