10
8/7/2019 Server side programs and scripts http://slidepdf.com/reader/full/server-side-programs-and-scripts 1/10 Server side programs and scripts Why Server Side Programming? Though it is technically feasible to implement almost any business logic using client side programs, logically or functionally it carries no ground when it comes to enterprise applications (e.g. banking, air ticketing, e-shopping etc.). To further explain, going by the client side programming logic; a bank having 10,000 customers would mean that each customer should have a copy of the program's in his or her PC which translates to 10,000 programs! In addition, there are issues like security, resource pooling, concurrent access and manipulations to the database which simply cannot be handled by client side programs. The answer to most of the issues cited above is ± ³Server Side Programming´.

Server side programs and scripts

Embed Size (px)

Citation preview

Page 1: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 1/10

Server side programs and scripts

Why Server Side Programming?

Though it is technically feasible to implement almost any business logic using client

side programs, logically or functionally it carries no ground when it comes to

enterprise applications (e.g. banking, air ticketing, e-shopping etc.). To further

explain, going by the client side programming logic; a bank having 10,000

customers would mean that each customer should have a copy of the program's in

his or her PC which translates to 10,000 programs! In addition, there are issues like

security, resource pooling, concurrent access and manipulations to the database

which simply cannot be handled by client side programs. The answer to most of the

issues cited above is ± ³Server Side Programming´.

Page 2: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 2/10

Server side architecture in the simplest terms .

Page 3: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 3/10

Advantages of Server Side Programs

A ll programs reside in one machine called the Server. A ny number of remotemachines (called clients) can access the server programs.

N ew functionalities to existing programs can be added at the server side which theclients¶ can advantage without having to change anything from their side.

M igrating to newer versions, architectures, design patterns, adding patches,switching to new databases can be done at the server side without having to bother about clients¶ hardware or software capabilities.

Issues relating to enterprise applications like resource management, concurrency,session management, security and performance are managed by service sideapplications.

They are portable and possess the capability to generate dynamic and user-basedcontent (e.g. displaying transaction information of credit card or debit carddepending on user¶s choice ).

Page 4: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 4/10

Typ es of Server Side Programs

Active S erver Pag es (ASP)

Ja va S ervlets

Ja va S erver Pag es (J SP s )

Enterprise J a va B e a ns (EJ Bs )

PHP

Page 5: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 5/10

Summa ry

The objective of server side pr og r am s is to centr a lly ma nag e a ll pr og r am s

rel a ting to a pa rticu la r a pplic a tion (e .g. Ba nkin g, Ins ur a nce , e-sh oppin g,

etc ). C lients with ba re m inimum req u ire ment (e .g. P enti um II, W ind ow s XP

P r of essi ona l, MS I nternet Expl orer a nd a n internet connecti on) ca n experience the pow er a nd per for ma nce of a S erver (e .g. IBM Ma inf r am e ,

Unix S erver , etc ) f r om a re mo te loca tion withou t ha ving to com pr om ise on

sec urity or speed . Mo re importa ntly , server pr og r am s a re no t only portab le

bu t a lso possess the ca pab ility to g ener a te dyn am ic resp onses ba sed on user¶s req uest .

Page 6: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 6/10

Commo n Ga te wa y Inter face

CGI is a st a nd a rd pr og r amm ing inter face to w e b servers tha t a llows bu ilding dyn am ic

a nd inter a ctive we b sites

CGI is not a pr og r amm ing la nguag e

± Its just a set of st a nd a rds (pr otocols )± The st a nd a rds speci f y how w e b a pplic a tions ca n be exec uted on the server side

CGI ca n be imple mented

± In a n interpreted la nguag e s uch a s P ERL

± In a n com piled la nguag e s uch a s C Any pr og r am ca n be converted to a CGI pr og r am

± It just ha s to fo llow CGI r ules

Page 7: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 7/10

The r u les de f ine± How pr og r am s get a nd sends da ta± How to ma ke s ure tha t we b server kn ow s tha t a pr og r am is a CGI

pr og r am ACGI pr og r am is

± S tored on the server

± Exec uted on the server ± Exec uted in resp onse to req uest f r om client

By r unnin g a CGI pr og r am, r a ther tha n deliverin g a st a tic HTML pag e , the server cab:

± Pu t dyn am ic a nd upd a ted infor ma tion on we b pag e (e .g., w e a ther forec a st , st ock price , pr oduct a va ilab ility)

Resp ond a ppr opria tely to u ser inp utS tore user da ta o n server-side in a f ile or DB

Page 8: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 8/10

Ca lling CGI pr og r am

CGI pr og r am ca n be ca lled in the s am e wa y a s st a tic HTML pag es

± For ex am ple , a link when clicked will r un a CGI pr g o n server side

± <a hre f=http ://www.m ywe bsite /cgi-b in/mypr og >Run my pr g</a>

It ca n be invoked by a fo r m

<for m a ction=³cgi-pr og. cgi´ meth od=³POS T´>

</for m>

CGI pr og r am s a re us ua lly exec uted a s pr ocesses

Page 9: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 9/10

How does it kn ow its CGI The we b server is conf igu red in a wa y tha t pr ovides cle a r distincti on

bet ween HTML a nd CGI f ilesUnix servers pu t the CGI pr og r am in cg i-b in direct ory

Access per m issi ons a re restricted , s uch tha t writing to this direct ory is

a llow ed to CGI invoca tionSecurit y issues with CGI± Pub licly a ccessi ble CGI pr g a llows a nyone to r un the pr g o n the serer ± Maliciou s users ma y be ab le to expl oit sec urity bre a ches a nd ha r m to ser bet

Page 10: Server side programs and scripts

8/7/2019 Server side programs and scripts

http://slidepdf.com/reader/full/server-side-programs-and-scripts 10/10

Br oa d steps in CGIBr ow ser sh ow s the docum ent conta ining the for mUsers enters the da ta into fo r m a nd click s ubm it bu ttonS cript in br ow ser will per for m client side va lida tionBr ow ser dec odes URL a nd conta cts server Br ow ser req uest the docum ent f ile f r om server

S erver tr a nsl a tes the URL into a pa th a nd a f ile nam eS erver re a lizes tha t URL po ints to a pr og r amS erver prep a res its envir onment va riab les a nd lau nch the scriptsS cript exec u tes a nd re a ds envir onment va riab les thr u S TDINS cript sends a ppr opria te MIME he a der to S TDOU T

S cript sends rest of its ou tpu t to S TDOU T a nd ter m ina tesS erver will no tif y the ter m ina tion of script a nd closes connecti on to b r ow ser Br ow ser displ a ys the ou tpu t f r om the script