|
Home
Using cgi-bin This section will tell you all you need to know about using cgi scripts on Demon's commercial web solution.
Basics All cgi scripts that you use with your Commercial Web Space, must be written in Perl 4 or 5 (we support 5.004). These files must be uploaded as ASCII (PC), Plain Text (Mac); so they are in Unix format on the server. So that the script is executable you must change the permissions of the file, this is done using the chmod command. Getting your scripts to work To change the permissions of the script, you will need to telnet to your web space (using the same details as with FTP). Once you are connected, this will provide you with a $ sign where you type the UNIX commands as detailed in the Using UNIX section. To set the permissions for your script so that it can be run by users browsing your pages, you need to follow these steps:
ls -l [where -rwx---r-x represents the permission settings for your file. You are interested in the last 3 characters. For your script to run from your web pages you need to make sure the 'x' or execute bit is set]. Calling your scripts from your html To refer to your cgi scripts from within a html document you should use:
If you need to reference your docs directory from your script then use:
Debugging your scripts Our web servers include a special function which allows you to produce debug output from your perl scripts via the web. If you find you are having problems with your perl cgi script, rename the script with the prefix xx- and then point your browser to the new name of the script. This then redirects the messages that would go to STDERR, to STDOUT, thus enabling you to receive some form of debugging information. Note: before trying this you may want to check the FAQ. For example, if you had a broken perl script in your cgi-bin directory again called my-script.pl, you would do the following -
In general terms, the more important part of the debug page is to look at the section after 'Output of script follows:' which displays the information that the actual script would output. For example, a script containing -
would result in the following at the bottom:
A full example of the output can be found here. cgi FAQ Commonly asked questions regarding using cgi scripts and their answers can be found in the Developing Your Site Further FAQ. Helpdesk Tel: 0845 272 2555 for Commercial Web support e-mail: websupport@demon.net Autoresponder: support@demon.net; Minicom: 0845 272 2445
|
©Copyright 2008 THUS
|