Preparation

Testing everything is set up correctly

To test that the CGI scripts are running properly we will download a short test script and then view it over the web. Download the script to your ~/WWW/cgi-bin directory and make the script exectuable by typing the following commands:

  cd ~/WWW/cgi-bin
  wget http://www.bioinf.org.uk/teaching/bbk/biocomp2/cgi/testcgi.py
  chmod a+x testcgi.py

Now you should be able to view the CGI script from a web browser using a URL like:

http://student.cryst.bbk.ac.uk/cgi-bin/cgiwrap/username/testcgi.py
(replacing username with your username).

You should obtain a message saying that everything is set up correctly. If not, consult a demonstrator!

Accessing your web page over the web

The HTML page can be accessed from a web browser using a URL of the form:

http://student.cryst.bbk.ac.uk/~username/mypage.html

where, username is replaced by your username and mypage.html is replaced by the name of the HTML page you have created in the WWW directory. Don't forget the tilde (~) in the URL before your username!

Accessing your CGI script from your web page

In your HTML page, you will access the CGI script using a URL of the form:

/cgi-bin/cgiwrap/username/myscript.py

where, username is replaced by your username and myscript.py is replaced by the name of the Perl CGI script you have created in the WWW/cgi-bin directory.

You MUST ensure that your perl CGI script is executable. Do not run it by typing

python myscript.py

Ensure it is executable by typing

cd ~/WWW/cgi-bin
chmod +x myscript.py
./myscript.py

(replacing myscript.py by the name of your CGI script.

Don't forget you should check that your script runs (i.e. has no syntax errors)) like this from the command line before you try to access it from a web page!

For the CGI script (in your ~/WWW/cgi-bin/ directory) your username is not preceded by a tilde (~)

For the HTML file (in your ~/WWW/ directory) your username is preceded by a tilde (~)

Continue