Install Apache + PHP + JSP + MySQL under Windows2003

xiaoxiao2021-03-06  82

First, PHP

Current version 4.3 1. PHP.INI-DIST REM is php.ini, copy to winnt, copy php4tsts.dll to winnt / system32, no need to copy or change other settings.

2. PHP.INI:

Register_globals = Off -> on extension = php_gd.dll Removes the comment, start the GD library extension_dir = ./ -> C: / PHP / EXTENSInsions

---------------------------------

Second, install Apache

Currently installed version 2.0.43 Configuring the httpd.conf file under the conf directory

# Install Apache Module How to add: loadModule PHP4_Module C: /PHP/SAPI/php4apache2.dll addtype application / x-httpd-php .php addtype application / x-httpd-php .php3 #alias / www / "c: / documents and Settings / Administrator / WWW / "(Virtual Directory, Custom)

# Install CGI mode Add: Scriptalias / PHP / "C: / PHP /" AddType Application / X-httpd-php4 .php Addtype Application / X-httpd-php4 .php3 action application / x-httpd-php4 "/ PHP / PHP "

# Add default startup document: DirectoryIndex index.html Add to: DirectoryIndex Index.html Index.htm Index.php Index.php3

# Let Apache2 default Chinese display # Add: addlanguage zh-cn .cn defaultlanguage en-cn # modified: adddefaultcharset ISO-8859-1 ---> AddDefaultcharset GB2312 ############## ##########################################

Test file info.php:

Enter http://localhost/info.php in the browser

---------------------------------------------

Third, MySQL installation

1. The default installation path is: c: / mysql

2. Run C: / MySQL / BIN / WINMYSQLADMIN, enter your username, password

// If you don't have this service: Open "Run" input c: / mysql/bin/mysqld-nt.exe -install. Then open the Administrative Tools -> Services to find the "MySQL" service and start it. Restart Windows2000.

============================================================================================================================================================================================================= ================== If JSP does not require JSP, install it to this. Let's start installing JSP ================================================= =======================4, install related software

1, download a JDK (J2SDK-1_4_0-win.exe), assume that it is installed as C: / J2SDK.

2, download the Resin for Windows version (2.1.6), address: http://www.caucho.com/download/, solution ... resin / bin / httpd -install, if you want to serve from the system service Delete, execute "C: / Resin / Bin / httpd - remove" on the command line.

3. Download the JDBC for MySQL file named mm.mysql-2.0.14-bin.jar Copy to c: / resin / lib directory (for JSP support MySQL). ----------------------------

V. Configure environment variables

Right-click on my computer -> Property -> Advanced -> Environment Variables -> System Variable Bar

1. Java_home Click "New ...", the variable name column fills in "java_home", the variable value column fills in "C: / J2SDK" and click "OK".

2, resin_home New a variable "resin_home", the value is "c: / resin".

3, ClassPath found ClassPath in the system variable bar, click "Edit ...", if there is no change, click "New ...", add C: /j2sdk/lib/tools.jar after the variable value; c : /j2sdk/lib/dt.jar; ", click" OK ".

Test Service: Execute: http: // localhost: 8080 You can see some environment variables of the current RESIN server. ---------------------------

Six, configure Apache bundle RESIN,

Perform a C: /RESIN/bin/setup.exe Select the Apache2 service, which will automatically add the C: /Apache/conf/httpd.conf file.

Or open C: /Apache/conf/httpd.conf, add loadModule caucho_module "c: /resin/libexec/apache-2.0/mod/caucho.dll" cauchoconfigfile "c: / resin / conf / resin .conf " setHandler caucho-status Modify the resin profile c: /resin/conf/resin.conf found this line: DOC Change: C: / Apache2 / HTDOCS

----------------------------

Under the C: / Apache / HTDOCS / directory, new file Test.jsp, the content is as follows:

2 2 = <= 2 2>

Run http: //localhost/test.jsp: 2 2 = 4 Description Apache Resin Configuration is completed.

-------------------------

Test mysql connection:

Suppose a database mysql is created in the MySQL database species, named User in the C: / Apache / HTDOCS / directory newly built a file Test-mysql.jsp, the content is as follows:

<% @ page language = "java" import = "java.sql. *" ContentType = "text / html; charSet = GB2312"%> <% string ls_username = "root"; // database username String Ls_password = "xxxxxx "; // password string ls_server =" localhost "; string ls_dbname =" mysql "; // database name connection connAn null; try {// registration JDBC connection drive class.forname (" org.gjt.mm.mysql.driver "); // Establish connection with the database Con = DriverManager.getConnection (" JDBC: MySQL: // " LS_SERVER " / " LS_DBNAME, LS_USERNAME, LS_PASSWORD);} catch (Exception E) {system.out.println (e) .tostring ());}%>

Test database connection </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# fffffff "Text =" # 000000 "> <% int li_count = 0; string ls_sql =" SELECT Count (*) from user "; // Name of the data table Try {statement stmt = con.createstatement (); ResultSet RS = STMT. ExecuteQuery; if (rs.next ()) li_count = rs.getint (1); if (rs! = null) rs.close (); if (stmt! = null) stmt.close ();</p> <p>} Catch (Exception E) {Out.println ("<BR> 2" E.TOString () "<br>");} Out.println ("A total of" li_count "record <p> test success ! ");%> </ Body> </ html> <% try {if (inc! = Null) Con. close ();} catch (sqlexception sqle) {system.out.println (sqle.toString ()) }%> If you access Test.jsp to access the database, you can.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-107830.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="107830" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.056</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = '_2B_2FtbHxxGeTg5_2BuQvY0KOeIMhJwjmG5f3h7xI2HQKpOq_2B9B71xr_2Bxf51pzKk2d0F5n82GbgGLEfmfSwMInaHZ7g_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>