Panix, New York's
	first
Internet Service Provider


Panix Web FAQ: CGI Languages


What languages can I use to write 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

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++?

C and C++ are powerful, but they aren't very portable languages. If you've compiled a C or C++ program on your own computer, it probably won't run on the Panix webservers (unless you happen to be using NetBSD at home, *grin*).

C/C++ programs compiled and functional on the Panix shell hosts should work on the Web servers too.

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.


Return to Index

Last modified: Thursday, 30-Aug-2007 15:54:02 EDT