Setting up CGI Programs in Your Personal Web Page
What is CGI ?
CGI stands for "Common Gateway Interface". It is a specification that allows an HTTP server such as the Netscape's Communications Server to run programs for generating "dynamic web pages" instead of "static web pages". CGI programs can turn your web page into an interactive one with its ability to process a user's input through forms. CGI programs are written either in the Perl or C programming languages. For an introduction to CGI, you can refer to the URL: http://www.hku.hk/local/cc/course/cgi/cgi.html
cd public_html
createcgi
You can now place your CGI programs in the public_html/cgi-bin sub-directory (using the file transfer program, FTP in your HKUWIN or HKUPPP window).
After placing the cgi program in the cgi-bin directory, you have to change the permission of the cgi program to executable by issuing the command:
chmod 755 <CGI-Program-name>
where <CGI-Program-name> is the name of your cgi program
To run your CGI program, you can use the following address in the URL field of your Web browser or an anchor in your HTML file:
/cgi-bin/cgiwrap/<login-name>/<CGI-program-name>
where <login-name> is the account name of your HKUSUA/HKUSUB account and the <CGI-program-name> is the name of your cgi program copied to the "cgi-bin" subdirectory.
Here is a sample cgi program called hello.cgi. Your can type this program into the "hello.cgi" file in the cgi-bin directory and then run it using the URL address as discussed above.
#!/bin/sh
echo Content-type: text/plain
echo
echo Hello, world
T. Y. Kan
Tel: 2859 7979
E-mail: hcxckty@hku.hk