Phone: +44 1865 980583
 
   Welcome to the Knowledge Base

  Articles
    A Simple PHP Template System
    Basic tips on optimizing for Google
    Beginner's web design tutorial
    The benefits of a Virtual Private Server (VPS)
    The myth of unlimited bandwidth
    VPS and reseller accounts compared
    What is CGI?
    What makes Digital Crocus different?

  Blogging Setup
    Setting up FTP hosting using Radio

  Disk and Bandwidth quota e-mails
    Bandwidth quota usage
    Disk quota usage

  Domains
    I've renewed, but my website's stopped working
    SSL secure website hosting
    Subdomains

  Dynamic Content (PHP and CGI)
    Uploading Perl CGI scripts
    Uploading PHP scripts
    Your own custom php.ini

  E-mail
    Creating mail boxes
    E-mail settings for other clients
    Outlook 2002 setup
    Outlook Express setup
    Setting up ActiveSync on your Windows Mobile based mobile phone or pocket PC
    Setting up mailboxes
    Subscribe to your spam folder in Outlook 2002
    Subscribe to your spam folder in Outlook Express
    Subscribe to your spam folder in Thunderbird
    Thunderbird setup

  How to upload your website
    CuteFTP setup guide
    Internet Explorer setup guide
    Settings for clients not listed
    SmartFTP setup guide

  Troubleshooting
    I can't login to MySQL
    My domain name won't work
      I bought my domain name from a different registrar
      I bought my domain name through Digital Crocus

What is CGI?

CGI, or Common Gateway Interface is not synonymous with Perl as some people assume. CGI is a way of replacing a static HTML page with a program or script that generates HTML dynamically. Until the rise of PHP, CGI was the most popular way to turn boring static websites into engaging and interactive web applications. CGI can be used for simple things like making a simple 'contact us' form that sends submissions to you via e-mail, or it can be used to create an online shop with a products database and secure credit card ordering. Until PHP came along, CGI was pretty much the only way all the complex web applications you use every day could be implemented.

So what exactly is CGI?

CGI is not a programming language itself, CGI is a standard method of interfacing any language with a web server. This means that any programming language can be used to generate the HTML pages you see in your web browser.

Each time your web browser requests a page, the request is transmitted over the internet to a web server, the web server determines what the request is for; is it a request for a plain old HTML page? Is it a request for an image? Or is it a request for a CGI script? If the request is for a CGI script the web server may extract some further information from the request, for example if the request was the result of a form submission; the web server extracts the data that was submitted. The web server then executes the CGI script in question and passes all this request information on to the script. The script may then do whatever it likes including pulling some information out of a database, sending an e-mail, processing a credit card transaction etc. After (or during) carrying out its work, the script will return some information to the web server to be sent back to the browser that originally made the request.

CGI is the mechanism by which data is passed from the web server to the script and back from the script to the web server.

What has this got to do with Perl?

CGI and Perl are often paired together and this can blur the line between the two. CGI is an interface, Perl is the programming language it is most often used with. There are many reasons for this, but probably the most compelling reason to choose Perl when writing CGI scripts is Perl's text (string) processing functions; with Perl it is very easy indeed to manipulate strings and this comes in handy when generating HTML pages on-the-fly.

How does Perl+CGI differ from PHP?

PHP itself is a programming language designed specifically for writing web applications (which Perl is not). PHP grew up after CGI and Perl were already established and was designed from the ground up for with web server integration in mind. PHP therefore bypasses the normal CGI mechanism for calling server-side-scripts because it is actually built directly into the webserver. This brings many benefits - it's faster, it hides away a lot of the nitty-gritty details of the web server from the programmer and makes it easier to use use web-specific features like sessions and cookies. There are problems with such tight web-server integration however, in particular it makes it difficult to implement tight security controls; for this reason at Digital Crocus we run PHP via a CGI wrapper (this is invisible to our users) - this allows us to offer the benefits of PHP but without the security risks.

Where can I find out more about CGI and Digital Crocus?

Click here to go to the Dynamic Content section of the knowledgebase.

 

Digital Crocus offers CGI as a standard feature on all accounts, this means you can write CGI scripts in any language that's installed on our server (this includes Perl of course).


Top ]


Questions Resellers Hosting Domains Home