Skip to Content

Faculty of Science

Personal Web Publishing

Personal web pages allow staff and students to write html, cgi scripts and publish them. Please note that all material published on Macquarie University web sites must following university publishing guidelines. You will be held responsible for all material you publish plus any breach of university guidelines.

On Unix systems, the "~" symbol means "your home directory".

Staff should login to verus and students should use platypus.

ssh johndoe@verus.science.mq.edu.au
johndoe@verus's password:

Create the html and cgi-bin directories if they don't exist:

mkdir ~/html ~/html/cgi-bin

Change the permissions on the directories for the web server to access the files:

chmod 711 ~
chmod 755 ~/html
chmod 711 ~/html/cgi-bin

While its ok for the world to see the contents of html, scripts are potential security holes. Keep them as private as possible. Scripts are executable, but not readable.

Create the following cgi script with a Unix text editor. Windows and Macintosh based text editors use different end-of-line characters that prevent cgi scripts from executing correctly.

#!/usr/bin/perl

 use CGI qw/:standard/;
         print header,
               start_html('A Simple Example'),
               h1('A Simple Example'),
               start_form,
               "What's your name? ",textfield('name'),p,
               "What's the combination?", p,
               checkbox_group(-name=>'words',
                              -values=>['eenie','meenie','minie','moe'],
                              -defaults=>['eenie','minie']), p,
               "What's your favorite color? ",
               popup_menu(-name=>'color',
                          -values=>['red','green','blue','chartreuse']),p,
               submit,
               end_form,
               hr;

          if (param()) {
              print "Your name is",em(param('name')),p,
                    "The keywords are: ",em(join(", ",param('words'))),p,
                    "Your favorite color is ",em(param('color')),
                    hr;
          }

Save the file as ~/html/cgi-bin/test.cgi and make it executable:

chmod 711 ~/html/cgi-bin/test.cgi

Try to execute the script from the unix command line:

~/html/cgi-bin/test.cgi

If there are no error messages, try running the script from a web browser:

http://web.science.mq.edu.au/~johndoe/cgi-bin/test.cgi