Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

19
502261-3: Web Systems By: Dr. Sara Jeza Alotaibi Assistance Professor College of Computers and Information Technology Taif University www.drsara.co.uk Course Website: http://www.drsara.co.uk/web-systems.html

Transcript of Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Page 1: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

502261-3:

Web Systems

By:

Dr. Sara Jeza Alotaibi

Assistance Professor

College of Computers and Information Technology

Taif University

www.drsara.co.uk

Course Website:

http://www.drsara.co.uk/web-systems.html

Page 2: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Chapter 17

Web Servers (Apache and IIS)

2

Dr.Sara Alotaibi @ 2015

Page 3: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Objectives

3

Dr.Sara Alotaibi @ 2015

Page 4: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Content of Chapter 17

4

Dr.Sara Alotaibi @ 2015

Page 5: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

A web server responds to client requests (typicallyfrom a web browser) by providing resources suchas HTML documents. When users enter a Uniform Resource Locator (URL)

address, such as www.deitel.com, into a webbrowser, they’re requesting a specific documentfrom a web server. The web server maps the URL to aresource on the server (or to a file on the server’snetwork) and returns the requested resource to theclient.

A web server and a client communicate using theplatform-independent Hypertext Transfer Protocol(HTTP), a protocol for transferring requests and filesover the Internet or an intranet.

5

17.1 Introduction

Dr.Sara Alotaibi @ 2015

Page 6: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

URIs (Uniform Resource Identifiers) identifyresources on the Internet. URIs that start with http:// are called URLs

(Uniform Resource Locators). Common URLsrefer to files, directories or server-side code thatperforms tasks, such as database lookups,Internet searches and business-applicationprocessing.

A URL contains information that directs abrowser to the resource that the user wishes toaccess.

http:// indicates that the HyperText TransferProtocol (HTTP) should be used to obtain theresource.

6

17.2 HTTP Transactions

Dr.Sara Alotaibi @ 2015

Page 7: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

7

Dr.Sara Alotaibi @ 2015

Page 8: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

8

Dr.Sara Alotaibi @ 2015

Page 9: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Two most common HTTP request types : getand post

get request typically gets (or retrieves)information from a server. Common uses ofget requests are to retrieve an HTMLdocument or an image, or search resultsbased on a user-submitted search term.

post request typically posts (or sends) datato a server. Common uses of post requestsare to send information to a server, such asauthentication information or data from aform that gathers user input.

9

17.2 HTTP Transactions (Cont.)

Dr.Sara Alotaibi @ 2015

Page 10: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

10

Dr.Sara Alotaibi @ 2015

Page 11: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Client-side scripting:

can be used to validate user input, to interact with the browser, to enhance web pages, and to add client/server communication between a browser and a web server.

Limitations:

1. browser dependency; the browser or scripting host must support the scripting language and capabilities.

2. Sensitive information, such as passwords or other personally identifiable data, should not be stored or validated on the client.

11

17.4 Client-Side Scripting versus

Server-Side Scripting

Dr.Sara Alotaibi @ 2015

Page 12: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Server-side scripting languages have awider range of programmatic capabilitiesthan their client-side equivalents.

12

17.4 Client-Side Scripting versus

Server-Side Scripting (Cont.)

Dr.Sara Alotaibi @ 2015

Page 13: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

To request documents from web servers, users must

know the hostnames on which the web server

software resides.

Users can request documents from local web servers

or remote web servers.

Local web servers can be accessed through your

computer’s name or through the namelocalhost—a hostname that references the local

machine and normally translates to the IP address127.0.0.1 (also known as the loopback address).

13

17.5 Accessing Web Servers

Dr.Sara Alotaibi @ 2015

Page 14: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

The Apache HTTP Server, maintained by theApache Software Foundation, is currently themost popular web server. It’s open sourcesoftware that runs on UNIX, Linux, Mac OS X,Windows and numerous other platforms.

MySQL is the most popular open-sourcedatabase management system. It, too, runs onLinux, Mac OS X and Windows.

The Apache HTTP Server, MySQL databaseserver and PHP can each be downloaded andinstalled separately, but this also requiresadditional configuration on your part.

14

17.6 Apache, MySQL and PHP

Installation

Dr.Sara Alotaibi @ 2015

Page 16: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

For simplicity, we’ll use the XAMPP integrated installerprovided by the Apache Friends website(www.apachefriends.org). Go tohttp://www.apachefriends.org/en/xampp.html

Choose the installer for your platform. Carefully follow the

provided installation instructions and be sure to read the

entire installation page for your platform!

16

17.6 Apache, MySQL and PHP

Installation

Dr.Sara Alotaibi @ 2015

Page 17: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

you’ve started the servers, you can open

any web browser on your computer andenter the address http://localhost/

to confirm that the web server is up and

running.

You’re now ready to go!

17

17.6.3 Testing Your Setup

Dr.Sara Alotaibi @ 2015

Page 18: Dr. Sara Jeza Alotaibi 502261-3: Assistance Professor ...

Now that the Apache HTTP Server is running on

your computer, you can save your program into

WAMP/WWW folder.

Assuming that you save your code as

filename.php

You can run the first example inhttp://localhost/filename.php

18

17.6.4 Running the Examples

Using Apache HTTP Server

Dr.Sara Alotaibi @ 2015