Php+apache+jsp+jboss+mysql In Ubuntu

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Php+apache+jsp+jboss+mysql In Ubuntu as PDF for free.

More details

  • Words: 543
  • Pages: 5
Installation & Configuration of JBOSS In Ubuntu Download: 1. Download JDK 6 Update 3 Linux binary (jdk­6u3­linux­i586.bin) file.  http://java.sun.com/javase/downloads/index.jsp  2. Download JBOSS.4.2.2.GA compressed file (jboss­4.2.2.GA.zip). http://labs.jboss.com/jbossas/downloads/  JDK Installation In Ubuntu: I have downloaded this file in Desktop root@indranil­desktop:/home/indranil/Desktop$ su  root@indranil­desktop : /home/indranil/Desktop# chmod 777 jdk­6u3­linux­i586.bin root@indranil­desktop:/home/indranil/Desktop# ./jdk­6u3­linux­i586.bin  root@indranil­desktop:/home/indranil/Desktop# vim /home/indranil/.bashrc Now append the following line at the end of the file export JAVA_HOME=/home/indranil/Desktop/jdk1.6.0_03 This sets the environment path of the JDK. JBOSS Installation: First, extract the jboss­4.2.2.GA.zip. This is all for installtion. Here I have extracted the above file in my Desktop folder. To run the JBOSS Application Server, execute the following commands in terminal­ root@indranil­desktop:/# cd home/indranil/Desktop/jboss­4.2.2.GA/ root@indranil­desktop:/home/indranil/Desktop/jboss­4.2.2.GA# cd bin/ root@indranil­desktop:/home/indranil/Desktop/jboss­4.2.2.GA/bin# ./run.sh

Author: Indranil Basu       E­mail: [email protected]        MAT3 Impex Pvt. Ltd., Kolkata­064

  http://localhost:8080

Installation of MySQL In Ubuntu

Installation Process: 1. Open “Synaptic Package Manager”. 2. Select “mysql­server­5” and mark it for installation. 3. And click on “Apply” button to install. 4. After the completion of MySQL installtion.

Connecting MySQL With JBOSS In Ubuntu Download “mysql­connector­java­5.1.5­bin.jar” file  http://dev.mysql.com/downloads/connector/j/5.1.html this link will give you a tar file. Get this file  extract and after that you will get the above mentioned .jar file. Then copy this .jar file to the following path ­ indranil@indranil­desktop:~/Desktop/jboss­4.2.2.GA/server/default/lib$ Now execute the following in terminal: # mysql mysql> create database indra; mysql> create table capitals( countryname varchar(30), capitalname varchar(30) ); mysql> insert into capitals values("India","Delhi"); mysql> insert into capitals values("Japan","Tokyo"); mysql> insert into capitals values("Bangladesh","Dhaka"); Author: Indranil Basu       E­mail: [email protected]        MAT3 Impex Pvt. Ltd., Kolkata­064

mysql> exit Now create a JSP file with the following code and name it “indranil.jsp” ­  <%@ page import="java.sql.*" %> <% String connectionURL = "jdbc:mysql://localhost/indra"; Connection connection = null; Statement statement = null; ResultSet rs = null; %> <% Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "root", ""); statement = connection.createStatement(); rs = statement.executeQuery("SELECT * FROM capitals"); while (rs.next()) { out.println(rs.getString("countryname")+" ­­ "+rs.getString("capitalname")+"
"); }

out.println("php"); rs.close(); %> Save this “indranil.jsp” file in the following path ./jboss­4.2.2.GA/server/default/deploy/jboss­ web.deployer/ROOT.war/JSP/ Now open your  browser, and paste this link (http://localhost:8080/JSP/indranil.jsp) to the  address bar.

Author: Indranil Basu       E­mail: [email protected]        MAT3 Impex Pvt. Ltd., Kolkata­064

Installation of PHP5 & Apache2 Installation Process: 1. Open “Synaptic Package Manager” 2. Select “php5”, “php5­cgi”,  “php5­common”, “php5­gd”, “php5­mysql”, “apache2”,  “apache2.2­common” and mark these for installation. 3. Click “Apply” to start installation. 4. After the completion of installation, click on this “http://localhost/” to open apache. 5. Now create a php file with the following content
$username = "root"; $password = ""; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); print "Connected to MySQL
";

  

  

$selected = mysql_select_db("indra",$dbh)  or die("Could not select first_test"); if (mysql_query("insert into capitals values('Pakistan','Islamabad')")) { print "successfully inserted record"; } else { print "Failed to insert record"; } mysql_close($dbh);

echo "
JSP"; ?> Save this file in /var/www/apache2­default/ folder named as“indranil.php”.

NOTE: I have made one line bold in both the jsp and php file, this would generate a hyperlink in the  respective pages which would allow the user to toggle from PHP to JSP pages of a same application. By this way we can run both PHP & JSP with MySQL connection in Ubuntu.

Author: Indranil Basu       E­mail: [email protected]        MAT3 Impex Pvt. Ltd., Kolkata­064

Related Documents

Ubuntu
June 2020 16
Ubuntu
May 2020 17
Ubuntu
April 2020 28
Ubuntu
May 2020 24
Ubuntu
November 2019 29
Ubuntu
May 2020 5