What languages are available for CGI programming?

What languages can I use for my CGI scripts?
Shell scripts: The first line of the file must be
#!/bin/sh
Perl: The first line of the file must be
#!/usr/local/bin/perl5
You can specify the version of perl you want to use by creating an environment variable in your .htaccess file, like this:
SetEnv PERL /usr/local/bin/perl-5.20.2
(You can set it to use whichever version of Perl you like.)
This is nice because it means you can use different versions of Perl for different parts of your website by using different settings in the .htaccess files in different directories. That way, if you redesign your site and part of it needs a newer versin of Perl, you can specify that version for the new part of your site without having to change the earlier pages.
Python: The first line of the file must be
#!/usr/local/bin/python
PHP: You may use PHP as a CGI language rather than using the in-apache module, in order to avoid the safe_mode restrictions that the module imposes.
The first line of the file must be
#!/usr/local/bin/php
You must also add a line to your .htaccess file assigning the filename extension you wish to use for CGI interpreted PHP to the CGI handler, e.g.:
AddHandler cgi-script .php
Ruby, C, and C++ also work.
Why can't I make my CGIs work in C or C++?

You can use C, C++, or any other compiled language on our webservers... but the binaries have to be compiled to run on NetBSD/Intel. The easiest way to do that is to build them on the Panix shell hosts. (A shell account is included with all of our web service packages.) But if you are running NetBSD and can compile to an Intel target, you should be able to build binaries that will run on our servers.

How come my Perl CGI works fine most of the time, but crashes at other times?

The strongest possibility is that the first line of your script looks something like:
#!/usr/local/bin/perl5 -*-perl-*-
The "-*-perl-*-" comment format isn't supported here at Panix. It's possible that our Web servers will treat it as a comment sometimes, but it's known to break scripts at other times. In other words, take the "-*-perl-*-" part out, and your script should start behaving.

Miscellaneous notes:

If you are interested in working on Perl CGI scripts on your home Wintel machine, you can check out ActivePerl, which is available for free download. The Web Developer's Virtual Library (WDVL) has an Introduction to Perl on Windows page, which looks helpful.

A lot of other scripting tools are available; these days, even Kermit has some web development functions available.



Last Modified:Tuesday, 02-Aug-2016 09:19:36 EDT
© Copyright 2006-2011 Public Access Networks Corporation