Learn something new every day
More Info... by email
Server-side scripting is a term primarily used with regards to serving custom content via the hypertext transfer protocol (HTTP) on a web server by having the server execute small programs. These programs, usually written in a scripting language, are executed by the server when a client request arrives. Depending on the parameters given by the client at the time of the request, the script then generates a web page for the client. Web pages created in this way are often referred to as dynamic pages. This is in contrast to a client-side script that is sent from the server to the requesting client and then executed.
The first server-side scripting techniques came about in order to deliver content that is unique to the user making the request, as well as save time by reducing the manual editing of the hypertext markup language (HTML) documents. The server-side scripts were often times small, executable files containing a series of commands to pass to the operating system. The web daemon, the software running the web server, would use these shell scripts to further execute an additional program residing on the host computer. This general technique was then defined in 1993 in the common gateway interface (CGI) standard developed by the Internet Engineering Task Force (IETF). In most cases, these early CGI scripts were used to send database responses from the server back to the requesting client.
As interpreted scripting languages were developed, such as Perl, and PHP: Hypertext Preprocessor (PHP), server-side scripting methods also evolved. HTTP daemons were updated to include use extensions that allowed for these various scripting languages to be called from the web daemon itself, instead of being passed to the operating system on the host. With this addition, bits of scripting language could be included within the HTML document. As the web server reads through a document before sending it out across the web, it checks for and executes any of the script within the document.
Since the content called up by server-side scripting resides in a database, it can be virtually anything. Content such as product descriptions, price variations, weblog entries, images, and even formatting is stored in the database. It is also possible to nest one server-side script snippet within another, where the first script grabs certain data from the database, but also calls a second script which accesses secondary data. This is useful, for example, when delivering some fairly custom standard content with additional nested content that may be time sensitive or as yet unknown, such as comments on a weblog entry. Web site maintenance, then, involves updating data in the database, which will then affect every page on the website with the included script to call that data.
Many of the server-side scripting techniques have been further developed into what are known as content management systems (CMS). PHP is probably the most frequently used language for this purpose, running at the core of many CMS implementations. Here, a user operating a website running on a CMS will edit her HTML documents to include what are called tags. The tags are essentially cues to the CMS to tell it what script to include in the document. The CMS can then be customized by creating additional scripts and their associated tags.