c/s B/s and web working principle

Source: Internet
Author: User

One, c/s B/s difference

(http://wenku.baidu.com/link?url=e8bxaqz_ LYCXWS6TLDRJEQ1QSLUMNTBHR3ES6EA1ZUHHHQ9FZGBVGOOMSVTHIIJBJRZRQI3HVPMG8OZSPNH1CHQKSN-S7LRI8V7HAQ-0AM_)

    • c/S full name client/sever, that is, client/server.

Through the client's browser (Browser), to the server to make a request to receive the results of its response, then, we call this collaboration is b/S mode, or b/s architecture

Give a chestnut: QQ

    • b/S full name browser/server, ie browser/server

Connecting a single machine to a network, such asAb Connected to the network, you can provide services between them, such as a to > provide services. Common services are file sharing, ftp file download, etc. We refer to the computer providing the (response) service as the server (serverclientworkstations). Client / How the server program works

For a chestnut: Blog Park

C b/S
Establish a foundation Lan Wan
Installation Need to install only need browser
Pressure High Client pressure High Server pressure
Other

High upgrade and maintenance costs, not affected by network speed, more secure

Cannot share resources with other computers when disconnected from the network

More adaptable, affected by network speed, not safe enough

Pay more attention to the speed of access, sharing of strong

Business development is convenient, maintenance is simple, compatibility problem is big

Second, the Web working principle

What is the 1.HTTP processing process?
Establish the connection--the client browser sends the request information---the >web server resolves the request and finds the appropriate resource to make the file and other information in the HTTP response back to the client--close the connection.

Three ways to work in 2.WEB

1), the server does not have the application and the database, requests the HTML file directly

2), server with application (e.g. PHP)

3), server with application and database

3. The server is the machine that undertakes the service task. These service tasks are done by the general specialized software.

Generally, the server software with a certain service function and the machine on which it resides are collectively referred to as xx servers (xx denotes a specific service). These software can be centralized in a single machine (5), such a machine can be called a centralized server, or can exist in a single machine (6), such a machine can be called a standalone server, multiple standalone servers can form a server farm or matrix.

The switch can connect multiple servers together as a server farm, and the following are common server software:

The specific process of 4.b/s work

5.PHP process of program work

The process is acollaborative process between Apache, PHP, and the browser:

The user requests the server through the browserPhpFile (for example, enter in the Address bar:http://localhost/index.php), ApacheIn the User document publishing directory on the server, look for the browser requested by thePhpFile, if it is not found, return an error message to the browser, otherwise, submit it tophp interpreter interpretation execution, interpreter to the php file parsing, if syntax error is found, then apache Returns an error message (represented by the code that the browser can recognize) to the browser, otherwise executes the php Program (may contain a database mysql, program execution results (indicated by browser-recognized code) apache< Span style= "font-family: the song Body;" > Back to the browser, the browser interprets and executes the returned results, and the results of the execution are displayed in the browser window.

If the browser is requesting a file that is not a PHP file, it is an HTML file or a JavaScript file. The process will be simplified:Apache finds the HTML file or JavaScript file requested by the browser under the user's document publishing directory on the server, returns an error message to the browser if it is not found, or returns it to the browser , the browser interprets and executes the returned results, and the results of the execution are displayed in the browser window.

c/s B/s and web working principle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.