Server-side scripting is a technique used in
web development
Web development is the work involved in developing a website for the Internet (World Wide Web) or an intranet (a private network). Web development can range from developing a simple single static page of plain text to complex web applications, ...
which involves employing scripts on a web server which produces a response customized for each user's (client's) request to the website. Scripts can be written in any of a number of server-side scripting languages that are available. Server-side scripting is distinguished from client-side scripting where embedded scripts, such as JavaScript, are run client-side in a web browser, but both techniques are often used together. The alternative to either or both types of scripting is for the web server itself to deliver a static web page.
Server-side scripting is often used to provide a customized
interface for the user. These scripts may assemble client characteristics for use in customizing the response based on those characteristics, the user's requirements, access rights, etc. Server-side scripting also enables the website owner to hide the
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
that generates the interface, whereas, with client-side scripting, the user has access to all the code received by the client. A downside to the use of server-side scripting is that the client needs to make further requests over the network to the server in order to show new information to the user via the
web browser
A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
.
These requests can slow down the experience for the user, place more load on the server, and prevent the use of the application when the user is disconnected from the server.
When the server serves data in a commonly used manner, for , according to the
HTTP
HTTP (Hypertext Transfer Protocol) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, wher ...
or
FTP
The File Transfer Protocol (FTP) is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and dat ...
protocols
Protocol may refer to:
Sociology and politics
* Protocol (politics), a formal agreement between nation states
* Protocol (diplomacy), the etiquette of diplomacy and affairs of state
* Etiquette, a code of personal behavior
Science and technology
...
, users may have their choice of a number of client programs (most modern web browsers can request and receive data using both of those protocols). In the case of more specialized applications, programmers may write their own server, client, and communications protocol, that can only be used with one another.
Programs that run on a user's local computer without ever sending or receiving data over a network are not considered clients, and so the operations of such programs would not be considered client-side operations.
History
Netscape
Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California, and then Dulles, Virginia. Its Netscape web browser was o ...
introduced an implementation of
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
for server-side scripting with
Netscape Enterprise Server, first released in December, 1994 (soon after releasing JavaScript for browsers).
Server-side scripting was later used in early 1996 by
Fred Dufresne while developing the first website for Boston, MA television station
WCVB
WCVB-TV (channel 5) is a television station in Boston, Massachusetts, United States, affiliated with ABC and owned by Hearst Television. The station's studios are located on TV Place (off Gould Street near the I-95/ MA 128/Highland Avenue inte ...
. The technology is described i
US patent 5835712 The patent was issued in 1998 and is now owned by
Open Invention Network
Open Invention Network (OIN) is an intellectual property rights company based in Durham, United States. It operates as an entity specialising in the acquisition of patents, subsequently granting royalty-free licenses to its community members. T ...
(OIN). In 2010, OIN named Fred DuFresne
"Distinguished Inventor"for his work on server-side scripting.
Explanation
In the earlier days of the web, server-side scripting was almost exclusively performed by using a combination of
C programs,
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
scripts, and
shell script
A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be command languages. Typical operations performed by shell scripts include file manipu ...
s using the
Common Gateway Interface
file:Common Gateway Interface logo.svg, The official CGI logo from the spec announcement
In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program to process HTTP or HTTPS ...
(CGI). Those scripts were executed by the
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
, and the results were served back by the
web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
. Many modern web servers can directly execute on-line
scripting language
In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
s such as
ASP,
JSP,
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
,
PHP
PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
and
Ruby
Ruby is a pinkish-red-to-blood-red-colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapph ...
either by the web server itself or via extension modules (e.g.
mod_perl
mod_perl is an optional module for the Apache HTTP server. It embeds a Perl Interpreter (computing), interpreter into the Apache server. In addition to allowing Apache modules to be written in the Perl programming language, it allows the Apache ...
or
mod_php
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, US
...
) to the webserver. For example, WebDNA includes its own embedded database system. Either form of scripting (i.e., CGI or direct execution) can be used to build up complex multi-page sites, but direct execution usually results in less overhead because of the lower number of calls to external interpreters.
Dynamic websites sometimes use custom web application servers, such as
Glassfish
GlassFish is an open-source Jakarta EE platform application server project started by Sun Microsystems, then sponsored by Oracle Corporation, and now living at the Eclipse Foundation and supported by OmniFish, Fujitsu and Payara. The support ...
,
Plack and
Python's "Base HTTP Server" library, although some may not consider this to be server-side scripting. When using dynamic web-based scripting techniques, developers must have a keen understanding of the logical, temporal, and physical separation between the client and the server. For a user's action to trigger the execution of server-side code, for example, a developer working with classic ASP must explicitly cause the user's browser to make a request back to the webserver.
Server-side scripts are completely processed by the servers instead of clients. When clients request a page containing server-side scripts, the application server processes the scripts and returns an HTML page to the client.
Server-side rendering
With the advent of
single-page application
A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of loading entire new pages. The goal is fas ...
s, an updated approach to server-side scripting was introduced, known as server-side rendering. With server-side rendering, static HTML can be sent from the server to the client, and client-side JavaScript then makes the web page
dynamic by attaching event handlers to the HTML elements in a process called
hydration. Examples of frameworks that support server-side rendering are
Next.js,
Nuxt.js,
Angular.
An alternative to server-side rendering is
static site generation. With server-side rendering, the page is generally assembled on the server once per each request. By contrast, with static site generation, the application generates all the static HTML pages at build time. These pre-built pages are then sent to the client at each request, without having to build them again. This leads to faster rendering times, since a new page doesn't have to be generated on every request; the server simply hands over a file it already generated in the past. The downside is that when some data on the page changes, it needs to be rebuilt. Examples of static site generation tools are
Jekyll
Jekyll may refer to:
Entertainment Film
* ''The Two Faces of Dr. Jekyll'', a 1960 horror film
* '' Dr. Jekyll y el Hombre Lobo'', a 1972 Spanish horror film
* ''Jekyll'' (2007 film), a 2007 horror film
Television
* ''Jekyll'' (TV series), a 20 ...
and
Gatsby. Sites generated by static site generation tools are often hosted on
Netlify,
Vercel
Vercel is an American cloud application company. The company created and maintains the Next.js web development framework.
Vercel provides developer tools, frameworks, and cloud infrastructure to build and maintain websites. It is the maker of ...
or
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
pages.
See also
*
Client-side scripting
A dynamic web page is a web page constructed at runtime (during software execution), as opposed to a ''static web page'', delivered as it is stored.
A server-side dynamic web page is a web page whose construction is controlled by an application ...
*
Content management system
A content management system (CMS) is computer software used to manage the creation and modification of digital content ( content management).''Managing Enterprise Content: A Unified Content Strategy''. Ann Rockley, Pamela Kostur, Steve Manning. New ...
(CMS)
*
Edge Side Includes
*
JSP
*
Node.js
*
Next.js
*
Outline of web design and web development
*
Perl/Plack
*
PHP
PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
*
Server Side Includes (SSI)
*
Web development
Web development is the work involved in developing a website for the Internet (World Wide Web) or an intranet (a private network). Web development can range from developing a simple single static page of plain text to complex web applications, ...
References
External links
{{DEFAULTSORT:Server-Side Scripting
Scripting languages