|
|
CGI
Scripts
Commercial Domain
customers have the ability to run cgi scripts in your very own "cgi"
directory. Scripts may be written in Perl or C. (C code must be compiled
prior to use.)
Installing scripts:
Perl Scripts
- Upload to your
cgi directory and ensure proper file permission settings
- Upload in ASCII
transfer mode (and NOT BINARY mode)
- The first line
of each script must read: #!/usr/bin/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 hard path
to your domain directory ("/domain/yourdomain/public_html"),
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.
Change this:
/domain/yourdomain/public_html/data/fact.html
To this: $ENV{DOCUMENT_ROOT}/data/fact.html
- The system path
to the sendmail program on our UNIX server is /usr/sbin/sendmail
- The system path
to the date command on our UNIX server is /bin/date
- The system path
to the perl command on our UNIX server is /usr/bin/perl
|