|
Web Space: CGI Essentials
CGI stands for Common Gateway Interface. It allows you to run a script on the Freeola Internet servers which can perform
tasks that are not available in HTML. For example, hit counters, guestbooks and random image displays to name but a few.
CGI scripts are simply text or ASCII files which are 'compiled on the fly' (interpreted by a program on the server rather than the browser) by the Perl interpreter. They can be edited or created on any text editor and must be saved with a '.cgi' file extension.
To run a script on the Freeola Server there are a few configuration settings for your
script which must be changed or added inside the script:
Path To Perl: #!/usr/bin/perl
This must be on the VERY first line or the script will not work.
Some or all of the following settings may be required by your script. If you
have downloaded a third party script there may be comments within the script to
tell you where to place them. Instructions could also be within any text files
which accompany the script.
Path To Sendmail: /usr/sbin/sendmail
For sending e-mail from your script:
Full Server Path To Web Space Root Directory:
This depends on your Freeola User Name. The last 2 numbers form part of the path (e.g. For 'sr0011223' the path is /freeola/users/3/2/sr0011223. For 'sr0024658' the path is /freeola/users/8/5/sr0024658.
Full Server Path To CGI Directory:
As the with the server path above to web space above, this is based on your Freeola User Name (e.g. For 'sr0011223' the path is /freeola/users/3/2/sr0011223/cgi-shl/. For 'sr0024658' the path is /freeola/users/8/5/sr0024658/cgi-shl/.
Full URL For Web Space:
Your web address as viewed by a browser (e.g. www.bob.spursfans.com or www.mydomain.com).
Full URL To CGI Script:
Your web address with '/cgi-bin/' added to the end (e.g. www.bob.spursfans.com/cgi-bin/).
Full URL To Temporary File:
This is probably the directory you wish to send information from your script to. Your web address plus a temporary file name (e.g. www.bob.spursfans.com/tempfile/).
E-Mail Address
The e-mail address which you would like your script to send e-mails to. The '@'
symbol in the e-mail address should be preceded by a '\' symbol. For example, 'john@spursfans.co.uk' would be john\@spursfans.co.uk. This is only required if you are setting an email address in the script itself.
Uploading CGI Scripts
CGI scripts must be placed within your 'cgi-shl' directory in your web space account otherwise it will not
work. The file MUST be transferred in 'Text' or 'ASCII' mode and NOT in 'Automatic' or 'Binary' mode.
Now that your script is on the server you need to set the 'Permissions' for the
script using your FTP software, this is the way that you open access to the script
for people accessing the website. Take care with this procedure as setting the
wrong permissions can deny even you access to the script.
In your FTP software there should be a link for 'Set Permissions' or CHMOD (if
you cannot find this link you may have to use a different FTP program). There
are two ways to change permissions for a file. The first is to enter a number
which will identify the permissions for the file. ALL scripts in the cgi-shl
directory should be set to CHMOD 777.
If your script outputs information to or creates a file or a web page the file or
page must be stored in a sub-directory of the htdocs directory. Create this
sub-directory using your FTP software, then using CHMOD again set permissions for the
directory and any file within it to 770.
|