Course Links

Resources

External

We have a dedicated server (zapp.smith.edu)for this course that will allow you to develop web pages with PHP and MySQL. The details below outline how to use this resource. Note that the server is only accessible from machines on the campus network. If you wish to work from off campus, you will need to install and use VPN software from ITS.

Each student will be issued a special computer account for use with this course. Via this account and password you can connect to both aurora.smith.edu and zapp.smith.edu. Use aurora to develop your files; they should be stored within the public_html folder in order to be made visible by zapp's web server. On the other hand, if you want command-line interaction with the database, you should connect to zapp and follow the instructions below.

MySQL Web Development

The pages you develop will be visible on zapp's web server. For example, if your course account is cs230a-xx and you create a file named lab1.php and store it in a folder called labs inside the account's public_html folder, it should be visible at the following URL: http://zapp.smith.edu/~cs230a-xx/labs/lab1.php. Adjust accordingly for your own account name and directory/file structure.

When your page is ready to connect to the database, you will use password-protected access. The account name you will use is the same as your main computer account. The database name is also the same except that hyphens are replaced with underscores. So in the example above the MySQL account would be cs230a-xx and the database name would be cs230a_xx. The password is identical to that of your main account. PHP will need this information to establish a connection with the database. To avoid making your secret details available to hackers, we will put them in a file in your account's home directory, which is outside the web folder public_html. Create a file called mysql_config.php in your home directory. Paste the following information, customizing it to your own account.

<?php
$mysql_user = "cs230a-xx";
$mysql_pw = "XXXXXXXXXX";
$mysql_db = "cs230a_xx";
?>

Your PHP files can include this file to gain access to its information, but it is not directly visible via the web server. The labs will give more guidance about how to establish a connection.

// grab connection details
require("/Users/classes/cs230a/students/cs230a-xx/mysql_config.php");

MySQL Command Line

In some cases you may need to make modifications to the database directly, rather than through a web page. For example, this is the easiest way to initialize the contents of the database. To do this you will make a secure connection to zapp.smith.edu. From the Unix command prompt issue the following instruction, modified with your own personal account details:

mysql --user=cs230a-xx --password cs230a_xx

(Note the underscore in the database name.) You will be prompted for your course account password, after which you should get the MySQL command prompt.

Alternatives

If you prefer, you can also install a web and database server on your own computer for development purposes. When it comes to grading, I will need your final product to on zapp, but you can do primary development on your own machine and port the final result. There are packages that come configured with everything you need -- search for LAMP, MAMP or WAMP (respecively, Linux/Mac/Windows, Apache, MySQL, PHP) software depending on your operating system.