From: Rob Turner on
Article #: 51 � Updated: Mon Apr 12 2010 at 12:41 pm
https://helpdesk.islandnet.com/newsite/help.php?cat=&art=51

Sooner or later most non-trivial web sites will need one or more custom
programs that run on the server (aka "CGI scripts"). In general we recommend
that any new scripts be written using the PHP programming language because
it's faster, more secure, and more portable than the alternatives. However, if
you want to run a pre-made script that is written in some other language, or
you simply prefer to program in another language (like perl, python, ruby,
tcl, etc) we support that too.

Unlike PHP, which is built in to the web server software itself, scripts
written in other programming languages are run as external programs. In order
to maintain security an intermediate program called "SafeCGI" is used which
sets up a secure environment before launching the script. All of this should
be transparent to you, however.

There is no need to place your CGI scripts in a special directory, but you can
if you want to. Just keep in mind that you can't use the name "cgi-bin" for
this directory because it's used for cgi scripts shared by all users. The
location of the script doesn't really matter as long as it's in your web
space. What's important is the filename of the script and the file
permissions.

Any file in your web space that ends with ".cgi" will be treated as a CGI
script and SafeCGI will attempt to run it. It must be owned by you and have
execute privileges enabled. The file itself may be a binary executable (as
long as it's compatible with our servers), or (more commonly) a text file
containing a script written in an interpreted language like perl or python.
For interpreted languages, the first line of the file is generally a "bang
path", which tells the operating system which program should be invoked to
interpret the rest of the code in the file.

Common bang paths include:

#!/usr/bin/perl
#!/usr/local/bin/python
#!/usr/local/bin/ruby

Note that certain filename extensions will force a specific interpreter. For
example, if your script name ends with ".pl", perl will be used regardless of
the bang path. An extension of ".py" will use python, and ".rb" will use ruby.


--
Islandnet AMT Solutions Group Inc.
Hosting, Domain Registration, PHP, MySQL, Python, Perl, Ruby, Other CGI's
since 1993!

Telephone / fax: 1-250-383-0096
Toll free phone / fax: 1-800-331 3055

E-Mail: support(a)islandnet.com
WWW: http://www.islandnet.com
Live Chat support with Islandnet staff from our website
Follow us on Twitter: islandnetcom

From: David Masover on
Hmm... really?

Going to take this apart, just for the record...

> In general we
> recommend that any new scripts be written using the PHP programming
> language because it's faster,

Nope:

http://www.slideshare.net/wycats/merb-camp-keynote-presentation

I'm sure it's faster if you run mod_php, and force Ruby to be run as a CGI,
but there's nothing inherent to PHP that makes it faster.

> more secure,

Citation needed.

> and more portable than the
> alternatives.

I'm going to guess that Perl is far more portable than PHP, and Ruby can run
in several places PHP can't (like the browser).

> However, if you want to run a pre-made script that is
> written in some other language, or you simply prefer to program in another
> language (like perl, python, ruby, tcl, etc) we support that too.

To the bare minimum...

> Unlike PHP, which is built in to the web server software itself, scripts
> written in other programming languages are run as external programs.

In other words, you run mod_php, but not mod_perl, passenger, or any of the
other, similar alternatives.

But hey, it is nice that they at least support generic CGI. Hopefully, I could
(theoretically) upload a custom binary to use as a bang path, right?

But no, CGI isn't really a good Ruby host, though there's probably Rack
wrappers for it. It's also downright unacceptable if we try to do anything
interesting, like Rails.