CGI Scripts - Super-charge Your Web Site
|Why 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.
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 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.
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:
"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:
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
Feel free to use this article
in your publication or web site.
Web Hosting Articles and Tips
Why Do You Need A Web Site In The First Place?
Web Design Articles and Tips
Web Site Design Basics - From Internet Marketers
Web Promotion, Internet Marketing Articles and Tips
Can You Still Make Money On The Internet?
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