Implementing Custom CGI Scripts
Our servers have the capability to run CGI scripts based on Perl, Unix SH, KSH, and CSH languages. Perl is a our language of choice as it is a world standard and is well
suited to CGI. In addition, Perl code does not require manual compilations whereas C code must be compiled* on our web servers prior to use.
If you have a custom CGI script that you need to use, simply upload it to your personal "cgi" directory and change the permissions to 711 for both the cgi folder as well as
your CGI scripts.
Here are some helpful tips to follow when installing scripts:
Shell Scripts
- Upload to your cgi directory to ensure proper file permission settings
- Upload in ASCII transfer mode (and NOT BINARY mode)
- The first line of each script must read: #!/sbin/sh or #!/sbin/csh based on whichever shell scripts you prefer using.
- Reference the script using /cgi (and NOT /cgi-bin)
- Always remember to include:
echo -e "Content-type: text/html\n\n"
Note: The '-e' flag is necessary to enable typical backslash escaped characters. For more info see the echo man page.
Perl Scripts
- Upload to your cgi directory to ensure proper file permission settings
- Upload in ASCII transfer mode (and NOT BINARY mode)
- The first line of each script must read: #!/usr/sbin/perl
- Reference the script using /cgi(and NOT /cgi-bin)
- Always remember to include print "Content-type: text/html\n\n"; or alternatively using the Perl module CGI.pm (If you do not, your scripts will not run and you will get an
Internal Server Error message).
use CGI qw(:cgi-lib :standard);
print header();
If a script calls another file within your account, but the script does NOT require a URL, you need to use the system path. Instead of using the absolute path to your home
directory ("/www26/web/someid"), you should instead use the DOCUMENT_ROOT environment variable ($ENV{DOCUMENT_ROOT} in Perl) to determine the path of your files or programs
within a script.
Example
From: /www23/web/yourid/data/fact.html
To: $ENV{DOCUMENT_ROOT}/data/fact.html
The system path to the sendmail program on your server is:
/usr/sbin/sendmail
The system path to the date command is:
/bin/date
[ top ]
If you need more help with any of our products or services please contact us at 1.888.Nationwide (628-4669)
|