What languages are available for CGI programming?
Shell scripts:
- The first line of the file must be #!/bin/sh
Perl:
- Using the perl5 wrapper:
- 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.24.2
You can set it to use whichever version of Perl you like. This allows you to 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 version of Perl, you can specify that version for the new part of your site without having to change the earlier pages. - Setting the version using the #! line
-
Various perl versions are installed in /usr/local/bin/. You can use any
installed version in a #! line at the top of your CGI script, e.g.
#!/usr/local/bin/perl-5.24.3.
In addition, we provide minor version specific links, e.g. /usr/local/bin/perl-5.24. These will generally point to the latest teeny version of that perl minor version.
Python
- The default python is python2.
- The first line of the file must be
#!/usr/local/bin/python - Various versions of python3 are available.
- To use one of these, the first line of the file must be
#!/usr/local/bin/python3
OR
#!/usr/local/bin/python3.x
where 'x' is replaced by the minor version you want to use.
PHP
- By default, php scripts run via php-fpm as user 'nobody', with a rather old version of php which behaves much like the old mod_php module, running as user 'nobody' with safe mode on. This is not ideal for most people. Fortunately, you can choose a number of php versions, which you can have run as your own userid, using a php handler. See our php info page for details.
Ruby
- We typically have actively maintained ruby versions installed on the web hosts. These may have teeny version upgrades from time to time, so we make series symlinks available for user in the #! line, e.g. ruby27 for ruby-2.7.x or ruby26 for ruby-2.6.x. The available versions mirror what's on the shell hosts, so you can check https://www.panix.com/shell/packages.html to see which are installed.
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, 22-Feb-2022 08:47:29 EST
© Copyright 2006-2021
Public Access Networks Corporation