CPSC 343 Database Theory and Practice Fall 2004

HTML/PHP Local Quick Start

This document is intended to describe the local environment for working with PHP in CS 343. Refer to the PHP Language Quick Start for information on the PHP language, the PHP Web Quick Start for information on getting information about the web server environment, processing HTML forms, and working with sessions and cookies, or the PHP MySQL Quick Start for information on interacting with MySQL from PHP.


Contents


Setup

Your PHP files will need to be web-accessible so they can be run. The webserver has been configured to look for your files in a very specific place. To set this up:

  1. If you do not already have a directory called cs343 in your home directory, create it.

  2. Within your cs343 directory, create a directory called web.

  3. Grant permission for the webserver to access the web directory:

    fs setacl ~/cs343/web system:anyuser rl
    

You must use exactly the names indicated (and with the same case).


Naming and Viewing Your HTML and PHP Files

All of the PHP and HTML files that you create should go within your cs343/web directory (or a subdirectory of that directory). Files containing PHP code must have a filename ending with .php; files containing only HTML code must have a filename ending with .html (or .php, but there's no reason to make the PHP processor handle a file without any PHP).

You can browse a listing of the files in your cs343/web directory with the URL

 
http://sbridgem/343/username 

where "username" is replaced by your Linux username.

You can go directly to a file by giving its URL e.g. http://sbridgem/343/bridgeman/datetime.php is the URL for a file called datetime.php in my cs343/web directory, and http://sbridgem/343/bridgeman/ex1/datetime.php would refer to a file called datetime.php in my cs343/web/ex1 directory (if there was such a file).


Viewing the Quick Start Examples

The examples used in the other Quick Start documents are available for you to try out. The URL: http://sbridgem/343/php-examples


Viewing the Webserver Error Log

Because the PHP is processed by the webserver, PHP syntax errors and other problems which prevent PHP from executing are logged to the webserver's error log. Normally this log file is not available to regular users, but to help your debugging, I have made it available via http://sbridgem/343/error_log. This is the entire error log for the webserver, so it contains much more than just your current error. However, the most recent additions are at the end and PHP errors include the filename where the error occurred - use this to help you locate the relevant information. Don't forget to reload the page in order to see the most recent version of the log.


Valid HTML 4.01!