PHP
Deepen the notion
of client/server
ISTA NTIC BENI MELLAL
OUHSSAINE MANAR
TIABI KHAWLA
PRESENTED BY SUPERVISOR:
MOHAMED REKHADDA
SALWA NAJARI
BAHI NOUREDDINE
PRESENTED ON 27/05/2024
Index
1 : Client/Server Principle
2 : 2-tier architecture
3 : Types of web servers
I. Introduction to the Client/Server Model in PHP
Welcome to Chapter 1 of our PHP course, where we will embark on a
journey to deepen our understanding of the client/server model. This
foundational concept is integral to how modern web applications are
built and operated. Throughout this chapter, we will explore:
1. The Principle of Client/Server
2. 2-Tier Architectures
3. Types of Web Servers
Why is the Client/Server Model Important?
In our daily lives, whether consciously or not, we rely on the client/server model for
nearly every digital interaction. When you browse a website, send an email, stream
a video, or use a mobile app, you are engaging in a client/server interaction. This
model not only enables these interactions but also ensures that they are efficient,
scalable, and secure.
Understanding the client/server model is essential for anyone looking to
delve into web development, particularly with PHP. It helps in grasping how
data is requested, processed, and delivered across the web, forming the
backbone of dynamic, interactive, and user-friendly applications.
What you will learn ?
By the end of this chapter, you will have a solid grasp of:
*Principle of Client/Server*: We will start by breaking down the basic concept of the client/server model.
You’ll understand the roles of clients and servers, how they communicate, and see real-world examples of
these interactions. For instance, when you enter a URL in your browser, how does the browser fetch and
display the requested webpage?
*2-Tier Architectures*: We will then explore the 2-tier architecture, a fundamental structure in many web
applications. This section will detail the responsibilities of each tier—how the client handles user
interactions and how the server processes requests and manages data. Understanding this architecture
will clarify how your PHP scripts fit into the broader context of web development.
*Types of Web Servers*: Finally, we will delve into the different types of web servers. From simple HTTP
servers to complex application and database servers, each plays a unique role in handling different aspects
of web services. Knowing the differences and functions of these servers will help you design and develop
robust web applications.
Setting the stage
Imagine a typical scenario: You want to check the latest news on a website. You open your browser, type in the
URL, and hit enter. What happens next is a series of sophisticated interactions between your device (the client)
and a remote machine (the server). Here’s a simplified breakdown of this process:
1. *Client Action*: Your browser (the client) sends an HTTP request to the server hosting the news website
2. *Server Processing*: The server receives the request, processes it (possibly running a PHP script),
retrieves the necessary data from a database, and generates an HTML response.
3. *Response Delivery*: The server sends this HTML response back to your browser.
4. *Display*: Your browser renders the HTML, displaying the news website for you to read.
This interaction, often completed in a fraction of a second, exemplifies the efficiency and power of the
client/server model.
Real-World Examples
To ground these concepts in reality, consider these everyday scenarios:
*E-Commerce*: When you shop online, your browser interacts with the server to display
products, handle your shopping cart, and process payments.
*Social Media*: Platforms like Facebook and Twitter use the client/server model to fetch and
display your feed, handle likes and comments, and manage user profiles.
*Email*: Email clients like Outlook or Gmail communicate with mail servers to send, receive, and
store messages.
These examples highlight the versatility and ubiquity of the client/server model in web
development.
Add Company Name
II. the principale of client-server
The client-server principle is a communication model where a client program sends
requests to a server program, which responds by providing the requested services. It's a
widely used model in computer systems, notably on the Internet, where web browsers act
as clients and web servers provide the requested web pages
definition of client
In programming, a "client" refers to a device or software that utilizes services or resources
provided by a server. The client sends requests to the server and receives responses based on
these requests. The client can be a computer, a mobile device, a mobile application, or any device
using communication protocols to connect to the server.
Definition of server
In programming, a "server" is a computer or software that provides services or
resources to clients that connect to it. The server receives requests from clients and
processes them, then sends back responses. For example, in web applications, the
server hosts the website and delivers web pages and content to web browsers that
request them.
What is middleware
Middleware is software that resides between two systems or applications to
facilitate communication and coordinate data between them. In a technical context,
Middleware is used in web applications and software to process requests and
responses, manage database connections, handle security authentication, and
perform other functions.
The relationship between the server and client
The relationship between a client and a server is the communication
process between them over the internet or a local network. The client is the
device or application that sends requests to the server, while the server is
the device or application that receives the requests and fulfills them by
providing the requested services or information.
III. 2-tier architecture:
Introduction:
* Two-tier architecture (also known as the client-server model of the first generation,
or data client and server) distinguishes client/server systems where the client needs
something and the server provides it directly using its own resources.
* The server processes the client's request without the need for external applications.
* This architecture allows full utilization of the power of network-connected computers
to provide a rich user interface, ensuring the coherence of centrally managed data.
* A centralized Database Management System (DBMS) is responsible for managing
data and is often operated on a dedicated server.
* SQL (Structured Query Language) is the most commonly used way to query a
database.
the interaction between the client and the server involves sending queries and
receiving data that aligns with these queries.
Level of abstraction
A computer application can be divided into three distinct levels of abstraction:
Presentation Layer (UI Layer : User Interface)
- It allows the application to interact with the user.
- It controls keyboard and mouse inputs as well as on-screen presentation.
- It should be user-friendly and ergonomic.
Layer of Processing
- It describes the processes to be executed by the application to respond to client
requests.
- Local processing: takes into account the controls performed at the level of
interaction with the UI (forms, fields, buttons,...).
- Global processing: represents the application rules also known as business logic.
Layer of Data
- It supports actions related to data access.
- It includes all mechanisms for managing the information stored by the application.
- Often provides the classic functions of a Database Management System (Data
Definition, Data Manipulation, Data Security, Transaction Management, etc.).
Gartner Group suggested dividing into six distinct views showing the
various possibilities of distribution between clients and servers of the three
software layers.
IV. Types of web servers
1. Definition and Purpose:
- A web server can refer to either hardware or software, or both working together.
- On the *hardware side*, a web server is a computer that stores web server
software and a website's component files. These files include HTML documents,
images, CSS stylesheets, and JavaScript files.
On the *software side, a web server includes several parts that control how web users
access hosted files. At a minimum, it consists of an *HTTP server
An HTTP server understands URLs (web addresses) and the HTTP protocol (used by
browsers to view webpages). When a browser needs a file hosted on a web server, it
sends an HTTP request to the server.
- The web server then processes the request, finds the requested document, and
sends it back to the browser via HTTP. If the server doesn't find the requested
document, it returns a *404 response* (indicating that the file is not found).
Static vs. Dynamic Web Servers:
To publish a website, you need either a static or a dynamic web server
A static web server consists of a computer (hardware) with an HTTP server
(software). It sends its hosted files as-is to your browser.
A dynamic web server includes a static web server plus extra software,
commonly an *application server* and a *database*.
The application server updates hosted files before sending content to your browser
via the HTTP server. For example, it might fill an HTML template with content from a
database.
Sites like MDN or Wikipedia use dynamic web servers because they have thousands
of webpages. These sites are composed of a few HTML templates and a giant
database, making it easier to maintain and deliver content.
How It Works?
When you request a webpage, your browser sends a request to the web
server.
- The web server searches for the requested file in its storage space.
- Upon finding the file, the server reads it, processes it (if needed), and sends it
to your browser.
the concept of browser clients
Definition:
- A web client typically refers to the web browser installed on a user's
computer or mobile device.
- It can also include browser extensions and helper applications that
enhance the browser's functionality to support special services provided by
websites.
- In simpler terms, a web client is the software that allows users to access
and interact with web content.
Functionality:
- When you open a web browser (such as Chrome, Firefox, Safari, or Edge),
you're using a web client.
- The web client communicates with web servers over the *HTTP protocol*
(Hypertext Transfer Protocol).
- It requests web pages, processes the server's responses, and displays the
content to the user.
- Users can interact with web forms, click links, view images, and perform
various actions through the web client.
Advantages of Browser Clients:
Efficiency: Browser clients are lightweight and use less processing power compared
to desktop applications. They don't burden your computer's resources.
- Accessibility: You can access browser clients from any device with an internet
connection. This flexibility is especially useful for people working across large
campuses or on the go.
- Minimal Installation: Browser clients don't require installation on your local
machine. They run directly within the browser, making them easy to set up.
- Storage Space: Since browser clients don't take up much space on your hard drive,
you can maximize storage for other purposes.
Examples:
Desktop Clients: These are software applications installed directly on your computer.
Examples include Adobe Illustrator, Photoshop, or any other locally installed software.
- Browser Clients: These are accessed through web browsers. Examples include
Google Docs, Sheets, and other online productivity tools.
In summary, browser clients provide efficiency, accessibility, and ease of use. They're
perfect for users who need to work across devices or have limited storage space.
syntax of a URL (Uniform Resource Locator)
Here are the key components of a URL:
Protocol: The protocol specifies the communication method used to access the resource.
Common protocols include HTTP, HTTPS, and FTP.
Domain: The domain represents the website’s address, which can include subdomains (e.g.,
“www” or “blog”).
Path: The path indicates the location of the resource within the website’s directory
structure.
Query: The query (if present) allows passing parameters to the resource.
Fragment: The fragment (if present) refers to a specific section within the resource.
For example, a typical URL might look like this: http://www.example.com/index.html, where:
Protocol: http
Domain: www.example.com
Path: /index.html
FOR YOUR TIME