How the Web Works

Source: Internet
Author: User
Tags php server php website

1.web Working principle

  I am learning PHP website Construction, then the site in the client and server run is the root of the site, the operation of the process is what? We'll do it!

  Web: www (worldwideweb)

  Server : We call the computer that provides the (response) service the server.

client : The computer that accepts (requests) the service is called the client (the clients), also called the workstation (workstations).

  

  1.1 Principle of server-side and client connection

  

The simple meaning is that the client requests the data and then feeds the service's request execution results back to the client.

Client/server collaboration between computers, called C/s mode, or C/s architecture.

Example: We take QQ as an example, the premise that each of us need to install QQ client, to see how the client and server chat QQ connection.

  

  

1.2 How browser/server programs work

We are doing the website construction, then the browser and the server side of the data interaction is our key research object.

If through the client's browser (Browser), to send a request to the server to receive the results of its response, then, we call this collaboration mode B/s, or b/s structure.

This is how the browser and the server link:

  

So how does the browser and the server work when the data interacts:

The client makes the request->web server-side control programming language for data processing and feedback to database---database to feed the corresponding data to server--server in programming language processing data The server feeds the processing results back to the browser.

  

2.PHP Process of program work

I am learning PHP, then PHP operating principle is the Apache, PHP, browser collaboration between the process:

  

The user requests a PHP file from the browser to the server (such as in the Address bar input: http://localhost/index.php), Apache on the server to find the PHP file requested by the browser, if not found, return the error message to the browser , otherwise, it is submitted to the PHP interpreter to explain the execution of the->php interpreter parsing the php file, and if a syntax error is found, the Apache returns an error message (denoted by the browser-recognized code) to the browser, Otherwise, the PHP program (which may contain MySQL for the database) is returned to the browser using the PHP program execution results (indicated by the browser-recognized code), and the browser interprets, executes, and executes the results 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, otherwise returns it to the browser and the browser interprets and executes the returned results. The results of the execution are displayed in the browser window.

2.1apache

Apache plays a pivotal role in the above process, so what is Apache?

    Apache is a Web server that listens on a TCP port, typically 80, interprets the commands the port receives, and then submits some results. the most important command that Apache interprets is GET and POST, which usually corresponds to the client in the browser input address, click on the browser inside the link and submit a form. Apache to get and post command interpretation, if get and post object is an HTML, CSS, JS, RAR, TXT and other general files, directly to the contents of the file sent back to the client; If the object is a PHP file, Apache will enable the PHP.EXE program (Unix name is not the same, and the details of the installation as a module are different, here is just an example), the file, The parameters of the call are passed to PHP.EXE, and the results of the PHP.EXE execution are fed back to the client.

  

So what other servers do you have to support PHP besides Apache?

PHP compatibility is very good, almost all Web servers are supported by PHP, mainstream can run PHP server has Apache Nginx IIS.

PHP: (hypertext Preprocessor) is also called hypertext preprocessor.

So what is hypertext?

Hypertext is a Web text that organizes the text information of various spaces together by means of hyperlinks. Hypertext is also a user interface paradigm for displaying text and related content to text. Hypertext is commonly present in electronic documents, where the text contains links to other locations or documents, allowing you to switch directly from the current reading position to the location pointed to by the hypertext link.

So now the Hypertext Markup Language we use most often is HTML.

How the Web Works

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.