1, the process of PHP call

Source: Internet
Author: User

The process by which a browser requests a PHP file

test.php

1 <HTML>2     <Head>3         <Metahttp-equiv= "Content-type"content= "text/html"CharSet= "Utf-8">4     </Head>5     <Body>6     <?PHP7 $i = 1 + 2;8 echo "The result is". $i;9     ?>Ten     </Body> One </HTML>

1, the browser (http://localhost/test.php) resolves the host name;

2, the host file (127.0.0.1 localhost) query the corresponding IP;

3, if the query is not, jump to the external network DNS;

4. The browser makes an HTTP request to the Apache server

GET http://127.0.0.1/test.php http/1.1host:127.0.0.1user-agent:mozilla/5.0 (Windows NT 6.3; Win64; x64) applewebkit/537.36 (khtml, like Gecko) chrome/54.0.2840.71 safari/537.36accept: */*accept-encoding:gzip, deflate, SDCH, braccept-language:zh-cn,zh;q=0.8

5, Apache parsing host;

6, Apache parsing site/directory;

7, Apache parsing resources (request file) name;

8, Apache request file (test.php);

9, test.php in <?php ...? > code executes on server side, Apache returns results to browser

http/1.1 Okdate:mon, Dec 12:23:55 gmtserver:apache/2.4.23 (Win64) Php/5.6.25x-powered-by:php/5.6.25cont Ent-length:137keep-alive:timeout=5, max=100connection:keep-alivecontent-type:text/html; Charset=utf-8<HTML>    <Head>        <Metahttp-equiv= "Content-type"content= "text/html"CharSet= "Utf-8">    </Head>    <Body>The result is 3.
</Body></HTML>

10, the browser displays the results returned.

Timing Diagram

1, the process of PHP call

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.