Describes in detail the relationship between php and apache and its functions.

Source: Internet
Author: User
The relationship between php and apache is a concern of many php learners. First, enter the website address in a browser on a client. For example, if we access the Internet on our computer, there will be a DNS server, it is used to resolve a domain name to a corresponding IP address, such as IP address 192.168.1.100, because the default port of the domain name address is port 80,

The relationship between php and apache is a concern of many php learners. First, enter the website address in a browser on a client. For example, if we access the Internet on our computer, there will be a DNS server, it is used to resolve a domain name to a corresponding IP address, such as IP address 192.168.1.100, because the default port of the domain name address is port 80,

The relationship between php and apache is of great concern to many php learners.

First, enter the website address in the browser of a client. For example, if there is a DNS server on our computer, the function of the browser is to resolve the domain name to a corresponding IP address, such as the IP address 192.168.1.100, because the default port of the domain name address is port 80, the final resolved address is: http: // 192.168.1.100: 80. then the network will find the corresponding server based on the IP address. This server is the base of the website. All the website programs are stored on this server. There will be a lot of software installed on this server. For example, MYSQL, WEB server (apache server), and qq. There is also a port number 80 in the address uploaded over the network. The IP part of this address is used to find this server, and the port number is used to find the specific application on this server. Because the default port of the WEB server is 80, the address is the web server in this service area. Because we mainly talk about php here, we choose apache server.

In the following example, if I enter an address on the client browser, the server 192.168.1.100 will be found, and the apache server will be located based on the port. Apachehe will return the code in index.html under a directory to the browser through the URL address, and then the browser will parse the returned code into the webpage content we see. This is how we access the webpage code. What if we access the PHP file?

For example, if you enter the address in the client browser and send it back to apache in 192.168.1.100, apache will see that you have uploaded the php file. If php is not installed on the server, he will also open the file and return all the code to the client. However, the client browser cannot parse the PHP file. Therefore, the front-end will display all the file code or download the file. This is not what we want to see. Therefore, we need to install a php service on the server. apache will first pass this file to the php program as soon as it sees that you have sent the php file, the php program first explains this file. Then it returns to apache, while apache returns to the client. In this way, the client can see the page effect after the PHP file is parsed.

The above is the role and Process played by the apache server and php in visiting a php page on the client.

The relationship and role of php and apache have been described. I hope you will get some benefits after reading this article.

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.