InstantRails Quick Setup Guide

Server Side Script, web No Comments »

1. Download the latest version from instantrails.rubyforge.org.

2. Use recommended tool [7-zip] to unzip the file.

3. If Apache has already been installed. go to 『\InstantRails\apache\conf』 and open httpd.conf [Apache setting file]. Change 『Listen 80″ to 『Listen xxx』 and 『Port 80″ to 『Port xxxx』

4. [for Windows] Double click on InstantRails.exe to start InstantRails.

InstantRails is self-contained-it doesn’t install itself into our global Windows environment. Therefore, it will not conflict with Apache Server that has already been installed on our machine. As long as we use different port, things will work fine.

InstantRails contains Apache and mySQL. If a machine has mySQL installed, we can change its port by going to 『program files—>mySQL—>mySQL Server x.x—->MySQL Server Instance Cinfig Wizard』

How to Test if Connector/j has been configuered

Server Side Script No Comments »

use a java code like this:

import java.sql.*;

public class JdbcExample1 {

public static void main(String args[]) {
Connection con = null;

try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test", "root", "secret");

if(!con.isClosed())
System.out.println("Successfully connected to MySQL server...");

} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}
		

Tomcat 5.5 + mySQL 5.0

Server Side Script No Comments »

1. Download mySQL from mySQL.com

2. Get mySQL Connector/J from http://www.mysql.com/products/connector/j/

3. Get Tomcat and mySQL work together. detail:

http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

[MySQL DBCP Example] section.

Please don’t forget to put JDBC Driver’s jar

(mysql-connector-java-3.1.13-bin.jar)

to $Tomcat_Home/common/lib.

Then set CLASSPATH to something like: TOMCAT_HOME%\common\lib\mysql-connector-java-3.1.13-bin.jar?

4. Before you try the example code on that [MySQL DBCP Example] section,

please go get JSTL (Java Server Pages Tag Lab) at:

http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi

and copy jstl.jar and standard.jar to your web app’s WEB-INF/lib directory.

Failure of doing this will generate an error page.

Apache 2.2 + PHP 5.2 Quick Setup Guide

Server Side Script No Comments »

== Setup Apache 2.2 ==

1. Get Apache 2.2 from here: http://httpd.apache.org/

2. Install to anywhere you like. ex: D:\Apache

3. You can also set DocumentRoot in httpd.conf file

(D:\Apache\conf\httpd.conf for example) and Type in:

?DocumentRoot 『D:/www/abcd/webApp/』

Note: Remember that when adding path values in the Apache

configuration files on Windows, all backslashes such as c:\directory\file.ext

must be converted to forward slashes, as c:/directory/file.ext. A trailing slash

may also be necessary for directories.

4. Make an index.html file and put it under you DocumentRoot. Open your Browser and

type http://localhost/ to see if you can see the page.

== Setup PHP ==

1. Download PHP 5.2 at : http://snaps.php.net/

(Please note that only PHP 5.2 work with Apache 2.2)

2. Put the .zip anywhere you like. ex: D:\PHP

3. Rename D:\PHP\php.ini-recommended to php.ini

4. Add D:\php to the PATH (Control Panel)

5. Set the doc_root to point to your web servers document_root.

For example:

doc_root = c:apachehtdocs // for Apache
(or doc_root = D:wwwabcdwebApp in our case)
6. Install PHP as an Apache Module:
you need to insert these two lines to
your Apache httpd.conf configuration file to set
up the PHP module for Apache 2.2:
# For PHP 5.2 do something like this:
LoadModule php5_module "D:/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "D:/PHP"
7. make a php page and put it under your document root.
Some Example can be found at:
http://www.php.net/manual/en/tutorial.firstpage.php