build-website-header
 

 Server Scripting

 Server scripting via ASP, PHP, Perl ,CGI can be used to create Hypertext Markup Language (HTML,XHTML) pages on the fly on the Web server that are then sent to the browser.

For example, you can use server scripting to query a database and format the results into an HTML page that is then sent to the user as a static page. All server scripting processing takes place before the page is sent to the browser.

The browser sees pure HTML/XHTML and not the script itself. This can be seen quite easily if you view the source code of the web page. All you will see is HTML/XHTML code.

How Server Side Scripting Works

However, you can use server scripting to create pages that can reach any browser with just pure HTML as the script is processed on the server.
The following figures illustrate how both client side and server side scripting works.
 

server side scripting




Let's look at this step by step:

  1.  A user clicks on a link .His web browser sends the request for the web page e.g. http://localhost/test.php.
  2.  The web server gets the request for test.php. It knows that .php files are handled by the PHP Interpreter (by the file extension .php) so it tells PHP to deal with it.
  3.  Test.php is a PHP script that contains commands. The commands are passed to the interpreter. The choice of interpreter will depend on what type of script we are dealing with.
  4. The interpreter places the result into an HTML page.
  5.  The HTML page is returned to the client.
     

Sever Side Scripting Languages

Scripting languages have grown up around the two major operating systems Unix (Linux) and Microsoft Windows. Therefore your choice of web hosting server  means that you are limited to languages running on that platform. There are four popular scripting languages (PHP, Perl, ASP, JSP) used to write server side scripts the one I prefer and use is PHP because it is supported on both Microsoft and Linux web servers.

ASP with VBscript is also a popular choice for people from a windows programming background. However if you are using this you should choose a windows hosting package.

Perl is being replaced by PHP and so is not a consideration and JSP is the preserve of large corporates and  it is not the choice of small/medium website designers.
 

You can find more detail on the languages in website FAQs

Server Side Includes (SSI) are sometimes classed as a scripting language but they basically consist of a special embedded commands.

Getting Server Scripts

There are two ways of obtaining scripts:

  • Write them yourself-This is not as difficult as it may appear and there are many resources available on the Internet which will help you in creating your own scripts. It is not however recommended for non technical people. I will however be starting a starting php tutorial series but in the meantime if you are interested in writing php scripts then I can recommend the site wizard.
  • Obtain them from others- There are many sources of scripts both free and commercial available on the Internet. The most obvious source is your hosting provider. Almost all hosting providers who provide the ability to run scripts provide a variety of standard scripts for you to use on your Web site. In fact many only provide this facility as they know that the scripts are secure.