|CPSC 343||Database Theory and Practice||Fall 2012|
This document is intended to describe the local environment for working with HTML and PHP in CPSC 343. Refer to the PHP 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.
Your HTML and 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:
If you do not already have a directory called cs343 in your home directory, create it.
Within your cs343 directory, create a directory called web.
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).
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
where username is replaced by your Linux username. If you are not using one of the lab computers, you'll need to use whitestar's IP address 172.21.7.83 in place of its name in the URL.
You can go directly to a file by giving its URL e.g. http://whitestar/cs343f12/fprefect/datetime.php is the URL for a file called datetime.php in fprefect's cs343/web directory, and http://whitestar/cs343f12/fprefect/ex1/datetime.php would refer to a file called datetime.php in fprefect's cs343/web/ex1 directory.
The examples used in the other Quick Start documents are available for you to try out. The URL: http://whitestar/cs343f12/examples
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 part of it available via http://whitestar/cgi-bin/view-error-log. This is the entire error log, filtered to include just errors within the cs343f12 directory. While many extraneous errors are filtered out, it still 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.