Apache+php+mysql+jdk+tomcat's installation

Source: Internet
Author: User
Tags install php ldap odbc pear php mysql

Using Yum to manage the installation of the Apache+php+mysql+jdk+tomcat, it's quick and easy, plus some security for Mysql, and notice that the fire wall has opened the relevant port, otherwise it is never connected.
This is a successful installation step on the CENTOS6.
1. Install Apahce, PHP, MySQL, and PHP to connect MySQL library components.
yum-y install httpd php mysql mysql-server php-mysql
2. Configure the startup service to set up Apache server HTTPD service startup
Chkconfig--levels 235 httpd on
Setup MySQL service startup
Chkconfig--levels 235 mysqld on
Activate the httpd service, and start with the machine
Service httpd Start
Activate MySQL service, with no machine
Service mysqld Start
3. Set the MySQL repository root account password.
Code inside the key
mysqladmin-u root Password "Both-win"
4. Make MySQL repositories more secure
Mysql-u root-p
Delete Test repository
mysql> DROP DATABASE test;
Delete Anonymous Account
Mysql> DELETE from mysql.user WHERE user = "";
Re-download permissions
mysql> FLUSH privileges;
5. In accordance with the above installation method, configure the implied setting:

Configuration file in/etc/httpd/conf/, the root of the document is recorded as/var/www/html/, tool files in the/etc/rc.d/init.d/, the journal documents in the/var/log/httpd/of the catalogue.
PHP's setup file for/etc/php.ini
Create a new PHP foot book:
<?php
Phpinfo ();
?>

Install Apache expansion
Yum-y Install httpd-manual mod_ssl mod_perl mod_auth_mysql

Expansion of PHP Installation
Yum-y Install PHP-GD php-xml php-mbstring php-ldap php-pear php-xmlrpc
Install MySQL expansion
Yum-y Install MYSQL-CONNECTOR-ODBC mysql-devel libdbi-dbd-mysql

One-time full-installed
yum-y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-x ML php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql

Use the root account to perform the following commands for JDK installation
Yum Install JAVA-1.6.0-OPENJDK Java-1.6.0-openjdk-devel
After the Yum installation process is complete, enter
Java-version
The JVM has been changed to 1.6. version 0
If your JVM is still old, you can change it in the following ways, choose the JVM you want to change
Update-alternatives--config Java
Next, set up the JAVA environment variables

Perform vim/etc/profile (use other editors, not limited to VI)

Enter the following content, Java_hoem into the JDK installation path, may be a difference

java_home=/usr/lib/jvm/java-1.6.0
Path= $PATH: $JAVA _home/bin
Classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar
Export PATH java_home CLASSPATH

Perform a re-start
Reboot
JDK Installation Complete

Use the root account to execute the following command to install TOMCAT 6 7 8 9
Yum-y Install Tomcat6 Tomcat6-webapps Tomcat6-admin-webapps
After the installation is complete, use the following command to activate Tomcat
Service Tomcat6 Start
In the browser, enter HTTP.//Your ip:8080/can see the screen, if you do not see whether it is a fire wall problem

Stop Tomcat
1.service Tomcat6 Stop
Activate Tomcat at the start of the machine
1.chkconfig Tomcat6 on
If you need a more advanced use of Tomcat and manage Tomcat, you can use the WEB management tools provided by Tomcat to manage

There is no way to use the TOMCAT management tool directly in the preset,

Tomcat-users.xml files need to be completed in advance

The setup is as follows (Tomcat-users.xml will be due to the installation
Different types of paths)
Vim/etc/tomcat6/tomcat-users.xml
Add the following content, the account password is test, the account and password can be set by themselves
1.<role rolename= "Manager"/>
2.<role rolename= "admin"/>
3.<user username= "test" password= "test" roles= "Admin,manager"/>

Re-activate Tomcat
1.service tomcat6 Restart
In the browser, enter HTTP.//Your ip:8080/, click on the left side of the management unit to enter the account password can be managed

Path to place WEBAP:/var/lib/tomcat6/webapps/
TOMCAT6 Installation path:/USR/SHARE/TOMCAT6


If the website needs to integrate Apache with Tomcat and can use JK or proxy, this will introduce the use of proxy to integrate Apache and Tomcat.

Edit proxy_ajp.conf files with VI

/etc/httpd/conf.d/proxy_ajp.conf
Input into the following content
1.proxypass/tomcat/ajp://localhost:8009/

After saving the file, re-activate Apache.
Service httpd Restart
In the browser, enter HTTP.//Your ip/tomcat/can see the screen, if you do not see whether it is a fire wall problem
Until now, the performance of PHP and JSP has been established, but we also need tight integration on both sides.

The latest Php/javabridge can download binary war files to http://sourceforge.net/projects/php-java-bridge/.

Get Javabridge.war file. Set the Unpackwars in the server configuration of Tomcat to True, and then copy the Javabridge.war to Tomcat's WebApps. Re-activate Tomcat to see the Javabridge in the WebApps catalogue.

Copy the Java subdirectories from the Javabridge catalog to the PHP catalog we're going to launch.

Write a test code:

1.<?php
2.require_once ("Java/java.inc"); Note the use of the path
3. $system = new Java ("Java.lang.System"); Use the System pack
4.header ("content-type:text/html; Charset=utf-8 ");
5. $s = new Java ("Java.lang.String", "I perform Java in PHP");
6.echo $s;
7.?>

The Java subdirectory contains the Php/java bridge source code that was actually used in PHP.

Test the new application from the browser.


This article from "Leekel" blog, declined reprint!

Apache+php+mysql+jdk+tomcat's installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.