# CGI Scripts - Islandnet.com KB Article

**URL:** <https://www.ruby-forum.com/t/cgi-scripts-islandnet-com-kb-article/192477>\
**Category:** Ruby\
**Created:** [July 30, 2010, 10:30pm UTC](https://www.ruby-forum.com/t/cgi-scripts-islandnet-com-kb-article/192477 "2010-07-30T22:30:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Turner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@Rob\_Turner](https://www.ruby-forum.com/u/Rob_Turner)\
**Post date:** [July 30, 2010, 10:30pm UTC](https://www.ruby-forum.com/t/cgi-scripts-islandnet-com-kb-article/192477/1 "2010-07-30T22:30:58Z")

</div>

Article #: 51 • Updated: Mon Apr 12 2010 at 12:41 pm

> **[Home - Web Hosting, Web Design, Programming : Islandnet.com](https://hd.islandnet.com/index.php?art=51&cat=&lang=en)**
>
> Web Hosting, Web Design, Programming, Python, Perl, PHP. WordPress, Joomla, Drupal, ModX and others CMS Hosting, MySQL - 1st Web Hosting provider in Victoria, Vancouver Island, BC, Canada.

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: removed\_email\_address@domain.invalid  
WWW: [http://www.islandnet.com](http://www.islandnet.com)  
Live Chat support with Islandnet staff from our website  
Follow us on Twitter: islandnetcom

---

<div class="post-metadata">

**Author:** ![Rob\_Turner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/73ab20/32.png) [@Rob\_Turner](https://www.ruby-forum.com/u/Rob_Turner)\
**Post date:** [August 3, 2010, 4:38am UTC](https://www.ruby-forum.com/t/cgi-scripts-islandnet-com-kb-article/192477/2 "2010-08-03T04:38:16Z")

</div>

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:

> **[Merb Camp Keynote](https://www.slideshare.net/wycats/merb-camp-keynote-presentation)**
>
> Merb Lessons Learned & Where Do We Go From Here Engine Yard Ruby is slow â€œItâ€™s also worth mentioning that there shouldnâ€™t be doubt in anybodyâ€...

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.
