Abstract: detailed account of JSP, PHP and JAVA integration development environment
<tr> <td>
This paper introduces the financial JSP, PHP and JAVA in a development environment furnace building, in order to fit the needs of the majority of beginners, many steps are quite easy to use, simple to understand. Generally, no special software needs, I used all the RPM installed. If you have optimal allocation of security considerations, such as special needs, please refer to the relevant additional information to configure.
In this paper, model DSO to install Apache, PHP has the support JAVA components, and has enabled us in the development of large-scale projects, as a front-end can choose PHP scripting language, called JAVA components to achieve the bottom and enterprise-class applications.
1. System environment
1. Initial installation
Firewall open interfaces: 21,22,80,2401,8009,10000, eth0
Redhat Linux 9.0
Development Tools
Network Servers
VSFtp
CVS-1.11.2-10
MySQL 3.23.54
2. Package installation
JDK 1.4.2_04 Download Address: http://www.netshine.com.cn/linux/j2sdk-1_4_2_04-linux-i586.rpm
Tomcat 5.0.19 Download Address: http://www.netshine.com.cn/linux/jakarta-tomcat-5.0.19.tar.gz
3. Installation script
Webmin 1.110 Download Address: http://www.netshine.com.cn/linux/webmin-1.110.tar.gz
ZendOptimizer 2.5.1 Download Address: http://www.netshine.com.cn/linux/ZendOptimizer-2.5.1-Linux_glibc21-i386.tar.gz
4. Compiler manual
Apache 2.0.49 Download Address: http://www.netshine.com.cn/linux/httpd-2.0.49.tar.gz
PHP 4.3.5 Download Address: http://www.netshine.com.cn/linux/php-4.3.5.tar.gz
JK 2-2.0.4 Download Address: http://www.netshine.com.cn/linux/jakarta-tomcat-connectors-jk2-src-current.tar.gz
5. Client environment
Windows XP Professional
Absolute Telnet 3.0
Zend Encoder
Macromedia Dreamweaver MX 2004
Borland JBuilder 9 Enterprise
WinCVS 1.3 Download Address: http://www.netshine.com.cn/linux/WinCvs13b17.zip
2. System installation
Booting Linux installation CD, install basic systems: FTP, development tools and MySQL3.23.54. If you are manually compile and install MySQL, it is necessary to remember that in the future, such as procedures for compiling PHP MySQL to specify the specific path, or they will find the path leading to compile errors.
3. Installation webmin1.110
Used to configure Webmin system, a fool, many energy can be saved, it is generally install it, I would have. The installation process is very simple, the implementation of the script after setup.sh as step by step tips on it.
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# Cd webmin * #. / Setup.sh </ Td> </ tr> </ table>
4. Installation JDK1.4.2
1. Edit the following three documents, did not specify the full path on your own home directory can be.
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Etc / profile JAVA_HOME = / usr/java/j2sdk1.4.2_04 CLASSPATH =.: $ JAVA_HOME / lib: $ JAVA_HOME / jre / lib CVSROOT = / usr / local / cvsroot PATH =.: $ JAVA_HOME / bin: $ JAVA_HOME / jre / bin: $ PATH export JAVA_HOME CLASSPATH CVSROOT PATH / etc / ld.so.conf / usr/java/j2sdk1.4.2_04/jre/lib/i386 / usr/java/j2sdk1.4.2_04/jre/lib/i386 / server HelloWorld.java class HelloWorld (public static void main (String [] args) (/ / This document testing Java environment is installed successfully. System.out.println ( "Hello World!");)) </ Td> </ tr> </ table>
2. Implementation of the following orders:
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# Rpm-ivh j2sdk *. rpm / / JDK installation package. # Source / etc / profile / / Heavy profile environment. # Ldconfig / / create dynamic link library cache file. # Javac-d. HelloWorld.java / / compiler test file. # Java HelloWorld / / operational procedures for testing the success of the installation. </ Td> </ tr> </ table>
5. Installed Apache
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# Tar xvzf httpd * / / decompression source package. # Cd httpd * / / enter the installation directory. #. / Configure - prefix = / usr / local / apache - enable-so - enable-mods-shared = most - enable-rewrite # make; make install / / Compile and install. </ Td> </ tr> </ table>
Description:
— Enable-so options: Let Apache can support DSO model that we used here is Apache2.0 syntax. If your Apache version is 1.3, should be replaced - enable-module = so.
— Enable-mods-shared = most options: tell the compiler to compile all of the standard modules for the DSO modules. If you use the Apache1.3, to - enable-can be shared = max.
— Enable-rewrite Options: address rewriting support functions, the use of the 1.3 version of it to a friend - enable-module = rewrite.
6. Compile and install PHP
1. Enforcement of the order:
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# Tar xvzf php * / / decompression source package cd php # * / / PHP installed into the Order #. / Configure - prefix = / usr / local / php - with-mysql - with-apxs2 = / usr / local / apache / bin / apxs - with-java = / # make usr/java/j2sdk1.4.2_04; make install / / Compile and install # cp php.ini-dist / usr / local / php / lib / php. ini / / Copy php configuration file # cd / usr / local / php / lib / php / extensions / no-debug-non-zts-20020429 / / extensions directory # ln-s java.so libphp_java.so / / connect, Oh, forget the mistakes will be # cd Zend * / / access ZendOptimizer directory #. / install / / installation PHP Accelerator </ Td> </ tr> </ table>
Description:
— With-apxs2 = / usr / local / apache / bin / apxs is Apache2 syntax, 1.3 version of the user to use the - with-apxs = / usr / local / apache / bin / apxs.
2. Edit the following three documents:
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Usr / local / apache / conf / httpd.conf LoadModule php4_module modules/libphp4.so AddType application / x-httpd-php. Php AddType application / x-httpd-php-source. Phps AddDefaultCharset gb2312 / usr / local / apache / htdocs / test.php / / This procedure tests the PHP JAVA environment is available, the code is extracted from http://www.php.net/manual/en/ref.java.php down. / / Get instance of Java class java.lang.System in PHP $ = new Java system ( 'java.lang.System'); / / demonstrate property access echo 'Java version ='. System-$> getProperty ( 'java. version ').' '; echo' Java vendor = '. system-$> getProperty (' java.vendor ').' '; echo' OS = '. system-$> getProperty (' os.name ').' '. system-$> getProperty (' os.version ').' on '. system-$> getProperty (' os.arch ').' '; / / java.util.Date example $ formatter = new Java (' java.text.SimpleDateFormat ', "EEEE, MMMM dd, yyyy' at the 'h: mm: ss a zzzz"); echo $ formatter-> format (new Java (' java.util.Date ')); -> / usr / local / php / lib / php.ini register_globals = On java.class.path [Java] = / usr / local / php / lib / php / php_java.jar: / home / jim / myclass java.home = / usr / java/j2sdk1.4.2_04 java.library = / usr/java/j2sdk1.4.2_04 / jre/lib/i386/libjava.so java.library.path = / usr / local / php / lib / php / extensions / no debug—20020429 non-zts extension_dir = / usr / local / php / lib / php/extensions/no-debug-non-zts-20020429 extension = libphp_java.so </ Td> </ tr> </ table>
NOTE:
(1) If you just from the previous version of the old switch to the new version of PHP, you may find PHP not use a lot of procedures. But the register_globals will open all normal. This is because older versions of PHP, it is switched on by default register_globals, and the new version, yet it held for the purpose.
(2). / Home / jim / myclass I kept JAVA components path, you can modify according to the actual situation, but for security reasons, not on the web directory.
7. Installed Tomcat
1. Implementation of the following orders
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
Jk2 * * # cd / jk/native2 / / connector into the compiler directory #. / Buildconf.sh / / running configuration scripts #. / Configure - with-apxs2 = / usr / local / apache / bin / apxs - enable - jni - enable-EAPI # make / / compiler module # cd ~ jim / src / * jk2 * / jk/build/jk2/apache2 / / compiler good entry module directory # *. so cp / usr / local / apache / modules / / / module will be copied to the Apache directory # cp-R jakarta-tomcat-5.0.19 / usr / local / tomcat / / Tomcat installation # touch / usr / local / apache / logs / shm.file / / set up a total of enjoy File </ Td> </ tr> </ table>
2. Edit the following documents
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Usr / local / apache / conf / httpd.conf LoadModule jk2_module modules/mod_jk2.so JkSet config.file / usr/local/apache/conf/workers2.properties DocumentRoot "/ usr / local / tomcat / webapps" / usr / local / tomcat / webapps / jsp-examples / for.jsp / usr/local/tomcat/conf/jk2.propertie handler.list = request, container, 8009 channelSocket.address channelSocket channelSocket.port = = = 127.0.0.1 channelSocket.maxPort port +10 / usr/local/apache/conf/workers2.properties [shm] file = / usr / local / apache / logs / shm.file size = 1048576 [workerEnv:] info = Global server options timing debug = 0 = 1 [ channel.socket: localhost: 8009] port = 8009 host = 127.0.0.1 [ajp13: localhost: 8009] channel = channel.socket: localhost: 8009 [uri: / *. jsp] = ajp13 worker: localhost: 8009 / etc / rc.d / init.d / httpd #! / bin / sh # chkconfig: 2345 92 12 # description: Starting Apache and Tomcat Server LD_LIBRARY_PATH = / usr/java/j2sdk1.4.2_04 / jre/lib/i386: / usr / java/j2sdk1.4.2_04 / jre/lib/i386/server export LD_LIBRARY_PATH CATALINA_BASE = / usr / local / tomcat export CATALINA_BASE CATALINA_HOME = / usr / local / tomcat export CATALINA_HOME APACHE_HOME = / usr / local / apache export APACHE_HOME JAVA_HOME = / usr / java/j2sdk1.4.2_04 export JAVA_HOME PROFILEDIR = / var / run case "$ 1" in start) if [-f $ PROFILEDIR/Tomcat5_Apache2] then echo "Running Tomcat5_Apache2" else if [-f $ CATALINA_HOME / bin / startup. sh] then if [-f $ APACHE_HOME / bin / apachectl]; then "$ CATALINA_HOME / bin / startup.sh" echo "Startting Tomcat5" sleep 3 echo "Startting Apache2" $ APACHE_HOME / bin / apachectl start echo "." touch $ PROFILEDIR/Tomcat5_Apache2 else echo "Apache File Not Founds" fi else echo "Tomcat File Not Founds" fi fi;; stop) if [-f $ PROFILEDIR/Tomcat5_Apache2]; then if [-f $ CATALINA_HOME / bin / shutdown. sh] then if [-f $ APACHE_HOME / bin / apachectl]; then "$ CATALINA_HOME / bin / shutdown.sh" echo "Stopping Tomcat5" sleep 3 echo "Stopping Apache2" $ APACHE_HOME / bin / apachectl stop rm $ PROFILEDIR / Tomcat5_Apache2 else echo "Apache File Not Founds" fi else echo "Tomcat File Not Founds" fi else echo "Not Running Tomcat5_Apache2" fi; *) echo "Usage;` `basename $ 0 (start | stop)" 1> & 2 exit 1 ;; esac exit 0 </ Td> </ tr> </ table>
3. Settings automatically activated
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# Chmod u + x / etc / rc.d / init.d / httpd / / modify the limits # / sbin / chkconfig - add httpd / / httpd to join the start-up list </ Td> </ tr> </ table>
8. Installation CVS
1. Edit the following documents
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Etc / xinetd.d / cvspserver service cvspserver socket_type = (stream wait = no user = root server = / usr / bin / cvs server_args =- f - allow-root = / usr / local / cvsroot pserver log_on_failure USERID = +) </ Td> </ tr> </ table>
2. Implementation of the following orders
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
# / Usr / sbin / useradd-d / usr / local / cvsroot cvs / / create CVS management users. # Passwd cvs / / create the management of user passwords. # Chmod 771 / usr / local / cvsroot / / modify CVS root directory permissions. # Su cvs / / CVS the identity of the user. $ Cvs-d / usr / local / cvsroot init / / initialization CVS repository. $ Exit / / withdraw from the CVS user identities. # Chmod 644 / etc / xinetd.d / cvspserver / / modify file permissions CVS launched services. # / Etc / rc.d / init.d / xinetd restart / / restart xinetd super-server. # Netstat-lnp | grep 2401 / / CVS service has been launched. # / Usr / sbin / useradd cvspub / / create CVS cvspub equivalent users of the system. # / Usr / sbin / usermod-G cvs cvspub / / cvs cvspub users to join group. # Cd / home/tets1 / / access test directory of the project. # Cvs import-m 'this is a test only' test1 v_0_0_1 start / / current project file import CVS repository. </ Td> </ tr> </ table>
Description:
CVS password, previously put forth for a period of some procedures to generate passwords, and some have used so-called soil means to copy shadow password. In fact, I can tell beginners one of the most easy and convenient way to do this is by adding CVS Webmin users, it will help you to generate their own passwords.
3. Edit the following documents:
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Usr / local / cvsroot / CVSROOT / passwd test1: NXWxabrVe7z / w: cvspub test2: FZTxeAWW.ySIA: cvspub </ Td> </ tr> </ table>
Description:
Is the user name in the final cvspub to replace test1 cvspub users of the system to read and write and test2 CVS repository.
<table CellSpacing=0 cellPadding=2 width=400 align=center border=0> <tr> <td class=code style="FONT-SIZE: 9pt" bgColor=#e6e6e6>
/ Usr / local / cvsroot / CVSROOT / readers test1 / usr / local / cvsroot / CVSROOT / writers cvs test2 </ Td> </ tr> </ table>
Thus, the entire system configuration completed.
</ Td> </ tr> </ table>
↑ Back
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: java environment variables
Releated Java Articles
May 6, 2007 | Filed Under
Getting Started |
Comments