Our servers have the capability to run CGI scripts based on Perl, Python, TCL, Unix SH, KSH, CSH, and C languages. We also support PHP. Perl is a language of that many are familiar with which is very well suited for writing CGI programs.
The appeal of Perl code is that it does not require compiling unlike C code which must be compiled on our servers prior to use (unless you have a commercial precompiled binary).
Here are some general helpful tips to follow when installing scripts:
Shell Scripts
1) Upload to your /var/www/cgi-bin directory to ensure proper file permission settings.
2) Upload in ASCII transfer mode (and NOT BINARY mode).
3) The first line of each script must read: #!/usr/bin/perl
4) Always remember to include echo “Content-type: text/html\n\n”.
Perl Scripts
A user asks “I am having CGI problems. Can you help?”
While we do NOT provide support for your PERL CGI script development, we present the following suggestions that may help. (Please DO NOT request support for PERL scripts. We supply the following in good faith and suggest you be careful of your PERL syntax.)
1) You may have uploaded your script in binary mode instead of ASCII. (A common mistake.) Try again, making sure that you specify ASCII mode when you upload. You may want to configure your FTP program to automatically select ASCII mode when transfering files with a CGI extension, as is done with HTM and HTML files.
2) Is your script written for PERL 4 or PERL5? (UK-Cheapest’s default is PERL 5.)
3) If PERL 5, check to see whether your atsigns (@) are preceded by (also known as “escape with”) backslashes (\). E-mail addresses in double quotes aren’t parsed correctly in PERL 5 if the backslash is omitted. For example, the correct syntax for UK-Cheapest support in a PERL 5 script would be sales\@uk-cheapest.co.uk
4) If PERL 4, you must specify the path to PERL 4, because our default is PERL 5. At UK-Cheapest PERL 5 is located in /usr/bin/perl.
5) Your PERL script resides in a directory that is group-writable or world-writable, or it is a subdirectory of such a directory. CGI scripts may not be located in such directories at UK-Cheapest, because they would make the UK-Cheapest server less secure. If you must create files that are world-writable, like a guestbook, place them in a separate writable directory, away from your CGI scripts.
6) You forgot to use the .CGI (or .PL) extension for your PERL file. Rename it.
7) Your PERL code just doesn’t work. Examine your syntax for mistakes, fix them, and try again.
8) Your file permissions are wrong.
9) CGI scripts require permissions of 750.
10) Changing permissions can be done with later versions of many FTP programs such as AceFTP or CuteFTP, or via your Web Control Panel if your Hosting Account with us is either Standard, Business or a Pro Account.
11) If none of the above help, and you didn’t write it yourself, contact the author of the script.
We are sorry, but the staff at UK-Cheapest cannot support your CGI programs other than offering the suggestions above.
For more information about CGI, do a web search, or find a good book. There are a lot of good resources available.