Lab #5.1: Exploring Your CS X
Server Account Environment
Purpose: In this lab,
you should gain the basic skills to work with the CS X server machine and the MySQL server installed on it. Eventually, we would like to
host your database projects and the web interfaces to your databases on the CS
X server machine.
Things to do and report:
Go over exercises 1~5 in the following and inform me of
your progress in these exercises in your weekly progress report.
How to upload or download
files to your account on the CS X server using FileZilla
- FileZilla is already installed in Metzger 100 and is
also available for download and installation from FileZilla website
- Use
the File-Site Manager option of FileZilla to set up the CS X server as a new site to
connect: Set host as compsci.biola.edu
and use the port number 22 and
pick the server type: SFTP using SSH,
then provide your account username and password.
- After
the setup, under the Site Manager press the connect button to connect to
your account on the CS X server. When the connection is successfully
established, you can navigate through the directory structures of your
accounts on your local computer and the CS X server to freely upload and
download files through FileZilla.
- Exercise 1: Create an index.html page (using WORD
or other software) and upload it to directly under the Sites folder of
your CS X account.
The URLs of your web pages on
CS X server
- The Sites folder of your CS X account
has the URL http://compsci.biola.edu/~YourUserName.
Accordingly you can access a web page XXX.htm under the Sites folder of
your CS X account as http://compsci.biola.edu/~YourUserName/XXX.htm.
- Exercise 2: Try to access the index.html page you
uploaded earlier from your web browser.
How to directly connect to
the MySQL server on the CS X server through phpMyAdmin
- As a
very handy alternative to using the mysql client program to interact (through the command line) with
the MySQL server, phpMyAdmin
is written in PHP to provide a convenient web interface to interact with
the MySQL server. We have phpMyAdmin
installed on the CS X server and you can do all the MySQL
tasks by interacting with the MySQL server
installed on the CS X server through phpMyAdmin.
- You
can get to the phpMyAdmin installed on the CS X
server by http://compsci.biola.edu/mysql/.
Provide your username and password through the web interface to connect to
the MySQL server on the CS X server. Two empty
databases test and YourUserName are already created there and you can
create addition tables in them.
- Exercise 3: After you get connected, select the test database that is already
created for you there and create a new product
table with this structure. Try to add records into
this table and submit queries regarding this table through the web
interface provided by phpMyAdmin.
How to use PuTTY to log into the CS X server and work with the server
as a UNIX environment
- Mac OS
X server is essentially a UNIX clone, and at times it is useful to log in
and interact with it through the command line. You can do this by using PuTTY. (If not
available from your computer, you can download PuTTY
from the PuTTY website and double click on the download ed executable to run it.)
- PuTTY’s interface looks pretty much like that of the
Site Manager of FileZilla, which you have played
with above. You can set up the connection to the CS X server under PuTTY almost like what you have done under the Site
Manager of FileZilla. After providing your
username and password, you can then log into the CS X server and work with
it through the command line.
- Exercise 4: Quickly go over the following UNIX tutorial (by the
Physics Dept, U. of Edinburgh) to understand the basic UNIX commands and
apply some of them to work around the system.
- Exercise 5: You can
also find the details regarding the use of a UNIX command (and at times
installed programs too) by man nameOfCommand.
For example, type man mysql to see the details regading
the use of the mysql client program. Then try to use
the mysql client program to connect to the mysql server installed on the CS X server by: mysql –u yourUserName –p. This should allow you to connect to the MySQL server installed on the CS X machine, and work with the MySQL
server in the way you did in Lab#2 to Lab#4.
********************************************************************
Lab #5.2: Create your first PHP-MySQL applcation
Purpose: In this lab,
you’ll (i) create 3 tables required in a very simple
online-book store application in your own MySQL
account on the OS X server and (ii) host your web interfaces and php script files on your own sites folder on the server to make
the simple online bookstore running on the CS X server machine.
How to build very simple web
interfaces to MySQL using HTML and PHP
Exercise 6: Play with these web
pages 1 and 2 or 3 to see how you can
1.
insert a new book into the books table in a
database through this insertion
of new books web page, and
2.
search for books based
on ISBN, Author, Title by querying the database through this online catalog query or this alternative
web page.
Exercise 7: Play with these web
pages 1 and 2 or 3 to see how you can
1.
Upload this bookstore.sql script to the root folder of your OS X
account
2.
Login into your own MySQL
account on OS X server, use the test database, and
create three tables described in bookstore.sql
by either manually typing in the SQL commands or just run the command: source bookstore.sql.
3.
Download and examine the related html and php
scripts files used in Exercise 6 into your own computer..
4.
Modify the php scripts
there to connect to your own MySQL account by using your
own user name, password, and your own test
database instead those in the php scripts.
5.
Upload the revised PHP script files and the original
html files into your own sites
folder.
6.
Access (from the Internet) those html pages you
just upload to insert new book and to search for books based on ISBN, Author.
Useful online references: