You can write scripts yourself or download them from the net. Many of the scripts are paid, but there are also free analogues. And it is not difficult to find them. Do not think that we are talking about low-quality product. You can download a good free script, but at the same time, you can download a bad one, written by an inexperienced user for a lot of money.
However, it is not enough to understand the scripts, you must also know how to work with them. It is appropriate to consider the situation with wrenches as a metaphor. Many people understand that different wrenches are designed for different purposes. It is not difficult to distinguish one wrench from another. However, using wrenches is a different story. The same applies to scripts.
Suppose you downloaded a script that was written by a professional. However, you will still need to customize it for your website, online store, any other resource or program you write yourself.
Thus, working with the script involves in addition to its configuration and installation. You also need to be able to run the script. Read more about it in the articles.
The scope of the scripts is enormous. For example, they allow the user to access databases, view visitor statistics (attendance counters), make entries in the guest books, leave comments on favorite articles, etc. The location of the executable script on the network may be different. For example, the script can be located on the same server as the page that calls it. Alternatively, the script may be located on a different, i.e. remote, web server. Since running the script “somewhere out there” allows you to perform some action, you should always keep in mind that such a procedure may not always be useful (i.e., it is not safe for the server owner). Particularly for this reason, not all servers allow the execution of scripts – usually, providers specially stipulate the conditions for providing such a possibility.
Well, now let’s introduce you to the subject and consider the implementation of scripts in more detail. Since today scripts are present in almost all web sites, you probably want to know how they look like and how they work. You can imagine the following picture – in a burst of curiosity you open the source code of html-page and find at the place where there should be this or that form, just a link to some “cgi-bin”. Here at this point, let’s stop our attention. All that will be below – only dedicated cgi-scripts.
CGI-script – a program that runs on a web-server at the request of the client. The client, in this case, is no one else than the website visitor. In principle, it can be argued that, as a program, CGI-script does not differ from, say, MS Word or the same Explorera. It is important to immediately realize that CGI is not a programming language in which the script itself is written, but only a Common Gateway Interface, i.e. a specialized interface which is used to kick-start the script and do the further work. In the very beginning of the article we mentioned that running scripts on a remote server can be unsafe – CGI scripts are no exception to this rule. Since hosting providers can prohibit the execution of cgi on their servers, then before you start your Internet project, you should make sure that such restrictions are not provided. For example, if you decide to have a site on free hosts (Narod.ru, for example), then the implementation of all kinds of benefits through cgi can not even dream of. In fairness it is worth noting that sometimes you can find a free hosting provider, which provides the opportunity to work with cgi. For example, runetovskii service holm.ru very welcome such customers.
But still – if you really want to fully realize your dream of a full-fledged website and use the opportunities provided by cgi-scripts, then you should opt for paid hosting. 90% of paid hosting providers fully support running remote procedures. Now let’s talk about how a CGI script works. Imagine that a visitor comes to your site, decides to fill in some forms – for example, in order to leave a comment he should enter the text of the comment, his name and the subject of the message. After filling out the required fields, the visitor clicks the “Submit” button. It is at this point that the request to the server is initialized.
Here’s what it looks like, if you try to explain everything on the fingers – after you click “Send”, the data are sent to the server, cgi script runs and the processing of incoming information. In our case, the text of the message and other additional values are read by the script from the form of the message and then written to the guestbook file, and instead of that, a message like this is sent to the visitor’s browser – “Thank you for your message”. You must be wondering what language a cgi-script can be written in. The answer is very simple – cgi-scripts can be written in almost any programming language! The only condition – it is the availability of the compiler (interpreter) of the language on the remote server. For example, servers running Unix interpret C/C++, Perl and Shell. A server running Windows work with the same C / C + +, Perl (plus other windows-system programming systems that support the writing cgi-programs – Visual Basic or Delphi). It should be emphasized that the vast majority of webmasters are still working on Perl and there are very good reasons for this.
The fact that Perl is interpreted language, ie applications made on Perl not require compilation. This situation is very convenient, because the web-programmer only need to debug an application on their computer (where, for example, installed Windows), and then simply copy their work on the server (which, without any doubt, is Unix – FreeBSD, Linux, Sun Solaris, HP-UX, etc.). Moreover, if after some time will need to transfer the site to another provider, the scripts will not cause any difficulties. But if you decide to use a compiler (for example, C/C++), you must compile the source code on the server, and this requires telnet access (many providers do not provide it willingly).
It is possible that you can’t do all of the above yet – for example, you don’t know the Pearl language yet. Don’t despair – you don’t need to know Pearl to implement all sorts of cgi applications on your site. This is equally true for the procedure setting cgi-scripts – in-depth programming knowledge is not required. That’s for sure. See why. The fact that you can find on the Internet a crazy number of completely free scripts that will not only meet your tastes, but also tasks – guest books of various stuff, complex databases and other bells and whistles lying in the network for nothing. You just have to take them and put them on your site. The only thing you will need is knowledge of English (at least at the basic level).
From myself we can recommend a wonderful resource cgi.resourceindex.com. This directory contains links to tens of thousands of scripts written in different programming languages. Let’s imagine you downloaded a script from this catalog and want to use it in practice. So. First of all, you need to adjust it a bit – at the very beginning of the script you need to specify some data. For example, the path to the interpreter Pearl (usually /usr/local/bin/perl/ or /usr/bin/perl/), your site address, the name of the file you want to write the results of the script to, etc. All of this is not difficult to do – the lines that need to be modified are usually specially highlighted with comments and you will not have any difficulty finding them at all.
Web server configurations vary, so the name of the script should contain the appropriate extension. On top of that, the script should be placed in a special directory. A classic example is that the name of the script should have the extension.cgi, and the script itself will be located in the cgi-bin directory. In order to perform the configuration to the end, you may need to consult with the technical support of your hosting provider or the server administrator.
As soon as you fully understand the requirements for the scripts in your case, all the problems will disappear by themselves and the script will start working properly. Don’t forget to assign the “executable” attribute to the script (a script is a program). If your script writes incoming information to a file, the file must be made writable. Most often, free scripts come with a full description on their installation – by carefully reading the help file, you will not only quickly cope with the task of installing, for example, a cherished guestbook, but also get a more detailed knowledge of how it works from the inside.
At this point we should probably call it a day – we’ve already bored you enough. If you have any questions about this article you can easily ask them on our forum.
On this page I will try to tell you about more complicated elements of site-building – scripts. For those who ran their eyes over the first few lines of the article and found it too arcane and difficult to digest, I advise you not to strain your brain and go to another page or to the last paragraph of this page.