Singapore Web Hosting - Web hosting, email hosting, web design and promotion services in Singapore.

CGI Scripts - Super-charge Your Web Site

SingaporeWebHosting.com

Singapore Web Hosting - Web hosting, email hosting, web design and promotion services in Singapore.

Home | Linux Hosting | Windows Hosting | Email Hosting | Domain Name | Web Design | Web Promotion | Reseller | Servers

Current Special

1 Year Free Web Hosting
included in our
Web Design Service

Web Hosting SingaporeWhy Choose Singapore Web Hosting .com
With thousands of website hosting companies why choose our service? Because we care about every customer and every detail of our business. We provide Unix / Linux web hosting, Windows hosting, email hosting, dedicated servers, domain name registration, web design and promotion services. And we make sure the job is always done right.

Home
Unix Hosting
Windows Hosting
Email Hosting
Domain Name
Web Design
Web Promotion
Reseller Plan
Dedicated Server
Support
FAQ
Resources

About Us
Contact Us

 

 

Singapore Web Hosting > Support

Super-charge Your Web Site With CGI Scripts

A lot of people have web sites but most feel that CGI scripts are "over their head". Not True! If you know basic HTML and know how to use FTP programs like WS_FTP to upload files, chances are you can super-charge your web site with a CGI script in about 30 minutes.

I'm not talking about writing CGI scripts. All you have to know is how to use CGI scripts. That's the purpose of this article.

With so many free CGI scripts available on the Internet, you are really limiting yourself if you are not using the CGI capabilities offered by your web hosting provider.

With CGI scripts, you can make your site more interactive with varies functions. You can communicate with visitors or customers much faster and easier. You can put your online business onto autopilot.

How does CGI script work?

You've most probably visited web pages and seen "cgi-bin" appear in the location bar of your browser. CGI stands for "Common Gateway Interface". When you see that "cgi-bin" appear in the location bar, you probably executed a CGI script when you requested that page.

CGI is utilized by placing an appropriate tag in your HTML code. If you download free CGI scripts from trustworthy sources on the Internet, the author of the scripts should provide you with the appropriate HTML tag needed to run that script. Look for readme file in the downloaded files.

When the page is requested by a browser, the server reads the tag, locates and executes the script file that's specified by the tag, and puts in the tag's place the results of the execution of the script.

If you've ever looked at your browser's settings, you've probably seen check boxes or radio buttons to enable or disable Javascript and Java but haven't seen anything for CGI. That's because Javascript and Java are executed by the browser. Your browser doesn't know anything about CGI. It just gets pure HTML from the server after the scripts are executed.

CGI and Perl

More than often you see the term "Perl" used together with the term "CGI". The two are not the same.

CGI is the process by which scripts are run. CGI programs, or scripts, can be written in a variety of computer languages including C. Perl is the most common language used for writing CGI scripts.

In practice, more than 90% of CGI scripts are written in Perl.

Three Steps To Using A CGI Script

Once you've downloaded the script you want to use, there are three basic steps you need to take in order to use the script on your server:

  1. Set any options or parameters that the script may need
  2. Transfer the script files (the script itself and any necessary data files) to your server and set the correct permissions
  3. Add the script's HTML tag to the page(s) you want to use the script

Set Options

"Setting Options" in scripts is typically just a matter of opening the .pl (or .cgi) file in a text editor and entering values for some of the scripts variables. For example, you may need to enter your email address if the script sends email notifications of some event.

Perl scripts typically have a .pl extension, but they may have a .cgi extension instead sometimes. It doesn't really matter. Files with other extensions, or no extensions, will likely be data files used by the script. Most script programmers will also include a readme file that contains information about the script and how to set it up.

More complex scripts may have more than one .pl file which may require different HTML tags for each one. It's also possible that one script may "call" another script so that only one tag is needed. Also, look for additional .pl files with names like config.pl or cfg.pl. These are script files where all of the user-settable options are entered and stored. If a file like this is included in the downloaded file, you typically don't have to open the main script file to set options. The main script will refer to this configuration script each time it is executed.

All of these files are typically combined into a single zipped file.

Some hosts may require that scripts must have a .cgi extension. It is normally not a problem to just rename the file to comply. If you do so, remember to change the extension in the HTML tag also.

Perl scripts are simply plain ASCII text files. Besides codes for web server, the programmer can also put comments and instructions in the script that users can understand. It is easy to spot these information that is meant for you to read because the line will start with # character.

The # character is the "comment" character in Perl. Any line that begins with a # does not get executed by the server.

You can simply use a text editor like Notepad to open the main, or if found the configuration, .pl file and check the top of the file for any information or setup instructions. If there is a readme file, open that in a text editor and look for setup instructions also.

The very first line of any Perl script is a user-settable option and is always going to be the path to your server's Perl installation, preceded by the characters "#!". This line is commonly referred to as the "shebang". Typical shebangs can be:

  • #!/usr/bin/perl     (often the Perl 4 location)
  • #!/usr/local/bin/perl     (often the Perl 5 location)

Setting options usually involves entering values for script variables. These values can be a '1', 'Y', 'y', 'YES', etc. to enable an option and a '0', 'N', 'n', 'NO', etc. to disable it. Certain user or system information may be needed for some variables. You may be asked to enter path information or an email address.

The comments in the script or the readme file should clearly indicate what the option is and what the valid optional values are.

Transfer Files And Set Permissions

Click here to continue

More Web Hosting, Design, Promotion Articles and Tips

Feel free to use this article in your publication or web site.
It's pre-licensed to you.
The only requirement is to include this resource box at the end of the article:

Article by Zac Hewlett at SingaporeWebHosting.com
Visit http://www.SingaporeWebHosting.com for more
web site design and promotion articles, proven online
marketing tips and techniques.

 

Web Hosting Articles and Tips

Why Do You Need A Web Site In The First Place?
What To Look For In A Web Host? 2
Why Do You Need Your Very Own Domain Name?
How To Choose A Domain Name?
What Can Server Side Includes (SSI) Do For You?
Super-charge Your Web Site With CGI Scripts 2
How Much Bandwidth Do You Need?
What's In The Mysterious Log File?
How To Use FTP?

Web Design Articles and Tips

Web Site Design Basics - From Internet Marketers Standpoint 2
Top 10 Deadly Web Site Design Mistakes 2
Easy Web Site Maintenance Using Server Side Include (SSI)
Should You Do Web Site Design In-house?
Cascading Style Sheets (CSS) Made Easy
Avoid "Lost" Traffic By Making Full Use Of Error Pages
What The Heck Is That? - All The Jargons Explained 2 3
How To Design An Effective Navigation System?
Are You Mad About Spam?
Ten Steps To Top Ranking Pages In Google 2

Web Promotion, Internet Marketing Articles and Tips

Can You Still Make Money On The Internet?
How To Rank High In Search Engines?
How To Get Listed In Yahoo? 2
The Power Of Opt-in List
How To Reach Millions Of People With Your Product For Free?
How To Get Thousands Of People Actively Promote Your Online Business? 2
The Strategy That Will Pay You Off For Years
Does Banner Ad Still Work?
One Stone, Three Birds - Newsgroup And Forum Participation
The Magic Word
How To Drive Targeted Traffic In 10 Minutes Time?

 

Singapore Web Hosting, Web Design, Web Marketing

 

Web Hosting Singapore | Web Hosting | Email Hosting | Domain Registration | Web Design | SEO | Resellers Plan | Dedicated Servers
Copyright © 2001-2009 Singapore Web Hosting .com Web Services Division of Silver Media
Privacy Policy | Terms of Use | SLA | Acceptable Usage Policy | Site Map | Singapore SEO | Singapore SEO