You are here

Server-side scripting

29 May, 2015 - 14:33

All the technologies that we’ve previously seen, such as HTML, JavaScript and Cascading Style Sheets, are technologies that run inside your browser. Once a webpage has been loaded, along with any accompanying JavaScript or style sheet code, you are good and ready to go.

But what if you need to access a resource that is beyond the limits of your browser? You may want to search a website’s catalogue for the latest and greatest digital camera from Sony, for example. In order to do this, you have to submit your search request via the webpage and send it to the Web server by clicking the Submit button.

Web servers are programmed to serve files, whether it’s an HTML document, a style sheet or an image file. They are are not designed to handle application-specific processes, such as shopping carts, online banking, or search engines. When the Web server receives a request such as the above catalogue search criteria, for example, it needs to hand it off to the program or application that has been written specifically to handle such requests.

The Common Gateway Interface, or CGI, allows Web servers to communicate with other programs running on the server so that these programs can process these user requests and send back the answers, usually in the form of a dynamically constructed webpage (as opposed to a static HTML document that is just residing on your Web server’s disk). The following video (adapted from Gundavaram 1996) illustrates how this works.

CGI, in effect, allows the functionality of your Web server to be extended, so that it doesn’t just serve files, but is also capable of running applications in response to user requests and then giving them back a response. This is what makes the Web truly interactive.