The relationship and role of php and apache

The relationship and role between php and apache is a problem that many friends who learn php are very concerned about

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

        The following example, if I enter the address in the client browser, he will find the server 192.168.1.100, and then find the apache server according to the port. Apache will return the code in index.html in a certain directory to the browser of the client through the URL address, and then the browser will parse the content of the web page we see according to the returned code. This is the case where we access the webpage code. What if we are accessing a php file

        For example, when you enter the client browser, he will also send this address to the apache in 192.168.1.100. When apache sees that you are passing a Php file, if the server does not have php installed, he will also send this address. The file is opened, and all the code in it is returned to the client, but the client browser cannot parse the php file. So the front desk will display all the code of this file, or there will be a situation to download this file. This situation is not what we want to see. So we need to install a php service on the server side, so that when apache sees that you are sending a php file, it will pass the file to the php program first, and the php program will interpret the file first. Then he returns to apache, and apache is returning 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 the client browsing a php page.

 

 

 

 

 

 

 

 

 

 

 

 

.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326110728&siteId=291194637