How to Create Your CSE Home Page


Your personal home page is a web destination where you can post content that will appear on the web.

Your default CSE home page URL will be of this form (where UBITName is your UBIT Name (userid)):

You can add functionality to your CSE web page including Server Side Includes (SSI), PHP, CGI, and MySQL integration. But first, we require that you pass the CSE Advanced Web Development Quiz to make sure you understand the risks associated with these technologies.

After you pass the quiz, your CSE home page URL will be of this form:

Procedure to Create Your CSE Home Page

When people invoke your home page, our HTTP server software, Apache, directs their requests to a directory named public_html in your home directory. If that directory does not exist, or if filesystem permissions do not allow the HTTP server (which runs as a normal "unprivileged" user) to get into that directory, the HTTP server will return a "File not found" error message.

Your CSE system accounts' default file and directory permissions are set such that only you can access things in your home directory. To make a public_html directory that the HTTP server can access, follow these steps:

Follow this procedure on any CSE Student General Compute Server. Those servers mount your home directory that's accessible by the web servers.

  1. Change directory (cd) into your home directory:

    % cd

  2. Enable execute permission on your home directory for all users:

    ~% chmod a+x ~

  3. Make a directory named public_html. Enable read and execute permissions on it for all users:
    ~% mkdir public_html
    ~% chmod 755 public_html
  4. Now you're ready to create the files and directories that will make up your web content. The first file you'll probably want to create in ~/public_html/ is the default index file, index.html:

    ~% cd public_html
    ~/public_html % vi index.html

  5. Enable all users to read index.html. Do the same thing for any other files and directories that you subsequently create within public_html. Directories will need their execute bits set for all users.

    ~/public_html % chmod a+r index.html

  6. Make sure all directory and file permissions are correct. Your read, write, and execute permissions should look like this:

    ~/public_html % ls -al
    drwxr-xr-x   5 username groupname      4096 Nov  4  2010 .
    -rw-r--r--   1 username groupname      2121 Nov  4  2010 index.html

  7. Finally, verify that people can view your web page:



  1. 404 - File not found usually means your file or directory permissions are incorrect.

CGI Mode

Running PHP in cgi mode is useful when you want to lock down certain files so that only your user account has access through the files system. When running in CGI mode the php executable will run as the owner of the file.

Appache will launch your php file as its own CGI executable through the suexec feature. This feature can only be used from home directories and from specially configured virtual hosts. See the following links for more details:

To have your php scripts run in CGI mode:
  1. Add the following to your .htaccess file (where the scripts will be run from):
    AddHandler cgi-script .php .php3 .php4 .php5 .phtml
  2. Be sure to add the php interpreter definition to the top of each php file.:

To test add the following script and load it in your browser. Open up top and look to see if the script appears to be running as your user ID.


// current time
echo date('h:i:s') . "\n";

// sleep for 10 seconds

// wake up !
echo date('h:i:s') . "\n";

If you need to import a bunch of PHP files you will need to add the interpreter definition to each file. The following shell script may add in the:
for f in `find | grep `
     sed -i '1i#!/usr/local/bin/php-cgi' $f


  1. Because your CSE webpage is hosted on a University at Buffalo server, you must comply with the UBIT Digital Millenium Copyright Act (DCMA) and Peer-to-Peer File Sharing Policies.