At present, the site page is mainly divided into static pages and dynamic pages, pure static pages of the site is relatively rare, the general use of large sites are dynamic site building technology, there are some sites are static Web pages and Dynamic Web site coexistence, this article to Apache Server, PHP language, for example, Detailed dynamic website access process, the following directly into the topic of this article.
(1) User-side access to server-side HTML files
S1: Look for a DNS server with a native configured DNS name server address, and resolve the web host domain name in the Web site URL to the corresponding IP address in the Linux operating system on which the Web server resides (Apache is typically used in combination with the Linux operating system).
S2: The HTTP protocol (Hypertext Transfer Protocol) to connect to the above IP address of the server system, through the default port 80 (the default port is 80, there are other ports, When entering a URL, you typically do not need an input port to request an HTML file (such as index.htm) in the appropriate directory on the Apache server.
After the S3:apache server receives a user's access request, it finds and opens the appropriate HTML file (such as index.htm) in the document directory that it manages, and responds to the client browser (that is, the user) with the file contents.
S4: After the browser receives a response from the Web server, it receives and downloads the server-side HTML static code, and then the browser interprets the code, which eventually renders the page (because different browsers interpret the code differently, so different browsers will have a difference in the final page rendering for the same page).
(2) User-side access to server-side PHP files
S1: This step is the same as accessing the HTML static Web page above, resolving the IP address of the corresponding Web server through the DNS server.
S2: Similar to the previous access to HTML static pages, but the final request is the Apache server on the appropriate directory of PHP files, such as index.php.
S3:apache server itself can not process php Dynamic language script files, and then to find and delegate to the PHP application server to handle (server-side prior to the installation of PHP application server), The Apache server gives the PHP file (such as the index.php) file that the user requests to access to the application server.
The s4:php application server receives PHP files (such as index.php), opens and interprets PHP files, translates them into HTML static code, and returns HTML static code to the Apache server, where the Apache server outputs the HTML static code it receives to the client browser (that is, the user).
S5: With the same access to the HTML static page as above, the browser receives and downloads the server-side HTML static code after receiving the response from the Web server, and then the browser interprets the code and eventually renders the page.
(3) User-side access to the server-side MySQL database
If the user needs to manipulate the data in the MySQL database, it is necessary to install the database management software MySQL server on the server side to store and manage the website data. Because the Apache server is unable to connect and operate the MySQL server, so also need to install the PHP application server, so that the Apache server to entrust the PHP application server to connect and operate the database, in the database in the management of data, generally need to use structured query statements, That is, the SQL statement.
S1: This step is the same as the above to access the PHP file, through the DNS server resolves the corresponding Web server IP address.
S2: As with the PHP file above, request access to the PHP file in the appropriate directory on the Apache server.
S3: As with the PHP file above, the PHP application server receives a delegate from the Apache server and receives the corresponding PHP file.
s4:php Application Server open PHP file, in the PHP file through the database connection code to connect to the local computer or other machines on the network MySQL database, and in the PHP program by executing standard SQL query statements to obtain data in the database, The data is then generated by the PHP application server to generate HTML static code.
S5: When the browser receives a response from the Web server, it receives and downloads the HTML static code on the server side, and then the browser interprets the code and finally renders the page.
It should be noted that the difference between (2) and (3) is that one accesses the database and the other does not access the database, so there is a slight difference in the process.
This article starts in Ye Dehua's blog: http://www.cheaplululemon.com, reprint please indicate website address.
Note: related website Construction Skills Read please step to the building station tutorial channel.
Reprint to: http://www.chinaz.com/web/2013/0216/292366.shtml
Take Apache server, PHP language as an example to explain the access process of dynamic website