What Are Server-Side Web Scripting Languages?

Server-Side Web Languages Overview

The term 'Server-Side' simply refers to the fact that these are languages that 'run' or process at the web-server, as oppposed to languages that process locally inside your browser.

This is a very important distinction, as the vast majority of web services would not be able to function with only 'client-side' or local processing. The server is where data is stored, and just about every web application or service needs access to a considerable amount of data to process and report on.

These then are the most common server-side scripting languages in use on web-servers around the world.

CGI (Common Gateway Interface)

CGI scripts are often found on web servers for performing common tasks such as hit counters. CGI scripts are written in several languages but the most common is PERL (Practical Extraction & Report Language.)

Most web hosts provide a few scripts that you can simply install on your website, and there are many more available to download if you take a good look around the web.

PHP (Hypertext Preprocessor)

PHP scripts are programs that run server-side to control and affect the output of HTML and often work with MySQL databases. They run on Linux Apache or Nginx servers, as part of the LAMP/LEMP stack, which at over 60% of the installed web-server base, are the most prevalent in the world. PHP is reasonably easy to learn, highly accessible, and impressive results can be achieved quite quickly.

Many consider PHP to be one of the most effective but simple to learn web programming languages. It is certainly one of the most popular, and is used to create most of the Web CMSs (Content Management System) available - such as WordPress, Drupal and Joomla. It is also used by Wikipedia, Facebook and Digg.

A simple example could be:

<?php
echo 'Date: ' . date('d-m-Y');
echo '<br />';
echo 'Server Time: ' . date('H:i:s');
?>

...In the first line, we’ve defined it as a php program. The next 3 lines all use the ‘echo’ command to print something to the browser window (or, strictly speaking, the html page-source - as you could echo output to control CSS, JavaScript or other elements, which don't necessarily affect the final visual text etc.). Line 2 uses the date function to print the current date in day-month-year format. Line 3 just outputs an HTML line break, so that the next text starts on a new line. Line 4 again uses the date function to print the local time at the server (PHP treats the date and time as part of one structure.) Line 5 simply signals the end of this PHP script, although there could be multiple scripts in a page that will execute top-to-bottom, one line at a time.

This example serves to clearly demonstrate three points:

  • First, it is running at the server – which is why the time is the server time (the server could be located in a data centre on US Central CST time, or in the UK on GMT for example) and not your local time.
  • Secondly, it is dynamically generated. Each time you refresh the screen, it will update – as it re-processes the program script. Note that the clock is not changing in your browser – it isn’t displaying a live time. The time that is displayed is the time when the script ran. So we have dynamically server-generated content, but not a dynamic browser element. If you used JavaScript you could create a clock that updated without refreshing – but the point here is that the script is being processed by the server and the output is served up to your browser.
  • Thirdly, if you viewed the web-page HTML source code from your browser (CTRL-U from within Firefox,) you would NOT see any of the above program code - only the date and time outputs, together with the HTML line-break. PHP runs at the server; so the code can never be viewed in a local browser - only the outputs from that code (unlike JavaScript and AJAX code which can be seen in the HTML source code.) This means the code is more secure.

Obviously, this is a very limited example, and not much use in its own right. But PHP can be intermixed freely with HTML, CSS, JavaScript & AJAX – and MySQL databases can be used to store and access data etc. For a real example of what can be achieved with PHP, just visit any of the previously mentioned world-class sites.

ASP (Active Server Pages) & ASP.NET

ASP scripts are Microsoft's equivalent to PHP pages. They process pages using the VBScript language and are interpreted line-by-line at the web server. ASP scripts run on Microsoft IIS web servers.

ASP.NET pages are a faster, compiled version of ASP, utilising Microsoft’s .NET framework. They carry the .aspx file extension.

PERL (Practical Extraction & Report Language)

Perl is one of the most popular languages for creating CGI scripts, and is highly effective at processing text. It is interpreted at run-time and not compiled, so it is easy to maintain.

Perl is actually a jack-of-all-trades, and is used in many different environments, as it was designed to be easy to use and practical from the programmer’s stand-point (rather than being easier for the interpreter or computer). It is a relaxed language and quite easy to pick-up for the beginner.

MySQL

Although SQL (Structured Query Language) is not strictly a programming language, it is a highly complex (yet accessible) query language - designed to make it as easy as possible to interact with large databases of information. SQL is just as much at home with a small database of 1,000 products, as it is with Amazon’s portfolio of millions, and is massively scalable.

Most server-side programming or scripting languages will be fully integrated with MySQL, which is an open-source (free) installation. It is also part of the favoured LAMP/LEMP stack, incorporating Linux, Apache/Nginx, MySQL & PHP.

MySQL is now owned by Oracle as part of the SUN Microsystems purchase in 2009.