Web Server
Web Server
web page is a document available on world wide web. Web Pages are stored on web server
and can be viewed using a web browser.
A server is a computer that serves information to other computers. These computers, called
clients, can connect to a server through either a local area network (LAN) or a wide area
network (WAN), such as the Internet.
Types of servers:
1.Proxy Servers
The Proxy server is responsible for a connection between a client(web browser or an app)
with and an external server to entertain the request for connection, performance enhancement,
and accessibility.
Gaming server has gained its popularity in a recent decay. This type of server is responsible
for connecting hundreds of gamers around the world to an external server(s) for accessing
gaming data.
3.Chat Servers
This server enables a number of people to share information in the environment of an internet
newsgroup that offer real-time discussion capabilities.
4.News Servers
They work as a source of distribution and delivery for hundreds of available public
newsgroups accessible over the USENET news network.
5.-Groupware Servers
It is software that is designed to make the users able to work together, regardless of their
location, through the Internet or a corporate Intranet and to work together in a virtual
environment.
6.Fax Servers
Those organizations that want to reduce the incoming and outgoing telephone resources; a
fax server is an ideal solution
7..FTP Server
File Transfer Protocol (FTP ) is one of the oldest server types. It is responsible for
transferring files from server to a computer and vice versa.
8.Application Servers
Application servers have lion’s share in computer territory between database servers and the
end user, where servers are often connected to the two.
Serves all the application operations between users and an organization backenend business
application or database.
\
Web server is a computer where the web content is stored. Basically web server is used to
host the web sites.
The basic objective of the web server is to store, process and deliver web pages to the users
.This intercommunication is done using Hypertext Transfer Protocol (HTTP). These web
pages are mostly static content that includes HTML documents, images, style sheets, test etc.
Apart from HTTP, a web server also supports SMTP (Simple Mail transfer Protocol) and FTP
(File Transfer Protocol) protocol for emailing and for file transfer and storage.
Web server respond to the client request in either of the following two ways:
● Sending the file to the client associated with the requested URL.
● Generating response by invoking a script and communicating with database
● When client sends request for a web page, the web server search for the requested
page if requested page is found then it will send it to client with an HTTP response.
● If the requested web page is not found, web server will the send an HTTP
response:Error 404 Not found.
● If client has requested for some other resources then the web server will contact to the
application server and data store to construct the HTTP response.
● Web server :Basically used to Generate or transfer the static data like any image or
file from the server to client.
In web hosting services, a web server stores all website data and secures it from unauthorized
users when it is properly configured
Web servers accept requests from different users connected over the internet and serve them
accordingly.
Dynamic web page shows different information at different point of time. It is possible to
change a portaion of a web page without loading the entire web page. It has been made
possible using Ajax technology.
Dynamic Content
Any content on your webpages that is subject to change, is classified as dynamic content.The
content of a website that does not remain constant and changes according to user input(s) is
referred to as dynamic content. For instance, in case of a product page, all product details
such as Product Name, Price, Quantity, and Description are stored in a database and are
fetched when a user is viewing the webpage of a particular product.
In-session behavior- Adapt content based on what pages they visit, which products they add
to cart, and how long they spend on site.
User data - Change content based on past purchases, customer lifecycle, or past engagements
with your marketing
It is interactive: Dynamic website a two way communication they provide content to users
and they allow user to submit information back to server .
Different step in creating the Dynamic content
In step 2 the browser consults an additional Internet service called the Domain Name Service
(DNS) to find its associated IP address and then uses it to communicate with the computer.
For dynamic web pages, the procedure is a little more involved, because it may bring both
PHP and MySQL into the mix:
Here are the steps for a dynamic client/server request/response sequence:
Error handling is the process of catching errors raised by our program and then taking
appropriate action.
These are functions dealing with error handling and logging. They allow you to define your
own error handling rules, as well as modify the way the errors can be logged. This allows you
to change and enhance error reporting to suit your needs.
When function return FALSE,we can use the die function in php to print an error message.
When php call die function,the application quits.
die(“message”)
1.
2. <?php
3.
4. // Php code showing default error handling
5.
6. $file = fopen("geeks.txt", "w");
7. ?>
Run the above code and geeks.txt file is not present then it will display an run-time
error message.
<?php
// If file is present
// then continue
else {
$file = fopen("geeks.txt", "w");
}
?>
What is cookie?
A cookie is a small piece of text file stored on user's computer in the form of name-value pair.
Cookies are used by websites to keep track of visitors e.g. to keep user information like
username etc. If any web application using cookies, Server send cookies and client browser will
store it. The browser then returns the cookie to the server at the next time the page is requested.
The most common example of using a cookie is to store User information, User preferences,
Password Remember Option etc
SESSION vs COOKIE
Exception handling is used to change the normal flow of the code execution if a
specified error (exceptional) condition occurs. This condition is called an exception.
It can be handled by
Try:A function using an exception should be in a "try" block. If the exception does
not trigger, the code will continue as normal. However if the exception triggers, an
exception is "thrown".
Catch: It represent block of code that will be executed when a particular exception has
been thrown.
Finally:It is used in place of catch block or after catch block basically it is put for
cleanup activity in PHP code.
Throw :It is used to throw an exception. It is also used to list the exceptions that a
function throws, but doesn’t handle itself.
Each try must have a atleast one corresponding catch or finally block.
Code within the finally block will always be executed after the try and catch
If an exception is not caught ,a fatal error will isused with uncaught exception
message.
For eg
<?php
$a =11;
try{
if ($a>=10) {
echo "$a";
}
else {
throw new Exception("Enter value greater than 10");
}
}
Following are the main advantages of exception handling over error handling