Class Project

The class project covers topics that you have covered in previous weeks and will give you an opportunity to review and practice what you have learned.

Step 1: Create a Virtual Host

  1. Create a new directory "private_club" within the DocumentRoot directory
  2. Create a new virtual host on your server with the name "www.private_club.com" that uses the directory you created in (1) as the DocumentRoot for the virtual host

Step 2: Add support for PHP

  1. Add support for php files on the www.private_club.com virtual host.  (This can be done in more than one way, but you only have to do it one way.)  PHP files are a kind of CGI application, so you will have to configure the directory appropriately and add the necessary handlers.) 

Step 3: .htaccess

  1. Require anyone accessing the directory to login using the login "member" and password "secret"

Step 4: Testing

You can not test the virtual host portion of the project, but you can test the PHP and .htaccess portions.  For PHP, you will have to install PHP from http://www.php.net/downloads.php.  You will also need a PHP file to test.

PHP files are HTML pages with code embedded in the page itself, similar to a server side include. To create a php file, open a text editor and enter the following:

<html>
<head><title>This is a test!</title></head>
<body>
<h1>
<?php
print "Hello, world!\n";
?>
</h1>
</body>
</html>

Save the file as hello.php into the proper directory on your server.  When you open the file with a browser, you should get a page that says "Hello world!"

Step 5: Turning in Homework

To receive credit for this lab, submit the httpd.conf  and .htaccess files in the Assignment area by midnight Wednesday. A screenshot of your PHP program running in the browser is also required.