What is Server side Scripting Language with Example

Server side scripting is a process in which server data formats into an HTML response before it is sent back to the web browser.

In other words, a process in which the script code is executed by the web server on the server side after the page is requested is called server side scripting.

The server accepts requests from the client’s computer, processes these requests, and sends the result (or output) to the respective client computers that has placed the requests.

The main advantage of server side scripting is that data processing is performed completely on the server side instead of client side, and raw data is never transferred across the internet.

Server side scripting helps to develop an interactive website that communicates with the database. It can be used to perform more complex tasks that need a lot of processing power.

It is more powerful than client side scripting, and just opposite to the client side scripting. If any problems happen on the server side, fixed up locally within the server side.

What is Server Side Script?

A server-side script is a program that is executed on the server side when the user requests information. The script do not download at the client side.

When the client or visitor requests the page, the web server reads it first. After reading, the web server locates the page file on the disk, loads into memory and asks the script engines (or interpreter) to process the script code.

After processing, web server generates the HTML page and pass back to the server. The browser processes the client side script along with the HTML web page from the server and display the web page on the client’s computer screen.

Look at the server side and client side scripts processing in the below diagram to understand better.

What is Server side scriptingThus, the client receives a pure HTML web page (possibly even client code) without any trace of server code. In this way, the server code secure enormously.

So, we can say that in the server side, all the tasks are carried out at a server end instead of on the client end, and then the result is sent back to the client end.

Server Side Scripting Language Example

The language in which server side script or program is written using syntax is called server side scripting language or server side programming language.
[adinserter block=”5″]
These kinds of scripts are always executed before a web page is loaded on the browser. Some common examples of server-side scripting languages are:

These scripting languages execute like programming languages at the server end.

Let’s understand a brief introduction about some widely used server side scripting languages one by one.

1. PHP: PHP, which stands for Hypertext Preprocessor, is a server side interpreted language. It is a widely used open source general purpose scripting language. It is primarily used to create dynamic web pages and websites.

The PHP code can be embedded into HTML. It is read and interpreted by the server to generate an HTML web page each time the page is requested by the client. This language was originally developed by Rasmus Lerdorf in 1994.

2. Python: Python is an object-oriented scripting programming language that was invented by Guido van Russom in 1991.

It is a general purpose programming language that is widely used in many applications today such as scientific computing, desktop applications, web applications, etc. It is very simple to learn and use.

Python is an interpreted language, that means Python interpreter executes the program line by line. One of the major advantage of using Python is that it is cross-platform language with interpreters available for every major operating systems.

Therefore, a single Python program can be executed across any platform, regardless of operating system and hardware.

3. JavaScript: JavaScript (originally known as LiveScript) is cross-platform, object-based scripting language that was developed by Netscape programmer Brendan Eich for both client side and server side.
[adinserter block=”2″]
It is a lightweight programming language that is interpreted by web browser when the web page is loaded. JavaScript is the most popular language and almost easy to learn as HTML.

It can be directly embedded into HTML document or used in the server side scripting language.

4. Perl: Perl (originally named Pearl) is a high-level, general-purpose, interpreted, and dynamic programming languages. It was invented by Larry Wall.

It is mainly used for a wide range of tasks including system administration, web development, network programming, GUI development, and more. Likewise, Python, PHP, it is also an object-oriented programming language.

Server side Scripting Example Program

Let’s take an example of a simple PHP server side script that dynamically adds the list of countries to an HTML document before sending it to the web browser.

Program code 1:

<!DOCTYPE html>
<title>List of countries/title>
       $countries = array("USA", "India", "France", "England", "Canada");
       foreach($countries as $country)
          echo "<li>$country</li>";

The above program file is located on the web server. The web server run this script to create new HTML like this:

<!DOCTYPE html>
    <title>List of countries/title>

This new HTML file is send to the client’s browser that produces the following output, as below:


As you can observe, that PHP script is located and executed on the server and so the HTML document sent to the browser is different from what is actually contained on the server.

Application of Server Side Scripting

The server side scripting is used to send the information to the web server to execute the script on the web server. Some common use of server-side scripting are listed, as below:

1. Server side scripting is used to protect the credential (username and password). When the user signs up any login web page first time, username and password are saved in the server.

Whenever a user wishes to log in, the web server verifies the credential (username and password) of the user with the username and password stored in the server. If they are matched, the user will be allowed to access the server side resources.

2. Whenever we submit an online application, the data or information entered in the form is stored in the database of the server.

Once the information is successfully submitted to the server via online forms, the information from the server can be accessed and represented in the form of report, forms, etc.

3. At server side, we can dynamically edit, add, remove, or update the content of web page at any moment.

4. It is used at backend, where the source code is not visible to the client.

5. Server side script can be used for creating and applying complex business logics.

6. It can be used to customize a web page to make it more useful for individual clients.

Advantage of Server Side Scripting

There are several advantages of using server side scripting languages that are as follows:

1. The main advantage of using server side scripting is that all the processing of data takes place before a web page is sent to the browser. As a result, server side script code remains hidden from users.

2. Server side scripting is an independent of browser. That is, browser does not impact on the processing of script code because all the data processing takes place on the server end.

3. It allows database interactivity with web pages.

4. Furthermore, it allows the use of templates for creating HTML web pages. A template is a file that contains HTML code to which contents from a text file, database, and other data retrieves dynamically before displaying the web page to the user.

5. Server side script cannot be disabled at the client side.

6. Server side scripting is more secure than client side scripting.

7. It can access files and database that do not normally be available to the client or user.

8. It provides code reusability.

Disadvantage of Server Side Scripting

There are also a few disadvantages of using server side scripts that are as follows:

1. We need a high configuration server to use server side scripting.

2. We require a lot of processing speed for running complex tasks. It possibly slows down the website if the server speed is not good.

3. Server side scripting is slower than client side scripting. It takes too much time because it requires request from the client.

In this tutorial, we have explained almost the key points concerning with what is server side scripting language with examples. We hope that you will have understood the basic need and working of server side script in the web technology. In the next, we will understand the basic difference between scripting language and programming language.
Thanks for reading!!!

⇐ Prev Next ⇒