PHP and Apache relationship and role is a lot of learning PHP friends are very concerned about the issue, this article mainly to share with you PHP and Apache relationship and role, hope to help everyone.
First the browser on a client to enter the URL, such as our computer if the Internet will have a DNS server, its role is to resolve the domain name according to the corresponding IP address, For example, the IP address 192.168.1.100, because the domain name address default port is 80 port, so the final resolved address is: http://192.168.1.100:80. The network will then find his corresponding server based on the IP address. This server is the base of the website. The site's programs and the like are placed on this server. A lot of software is installed on this server. such as Mysql,web server (Apache server), QQ and so on. There is also a port number in the address sent over the Internet 80. The IP part of this address is to find the server, and this port number is the role of the server to find the specific application. Because the default port for the Web server is 80, the address is looking for a Web server on this service area. Because we mainly speak PHP here, so we choose Apache Server.
The example below, if I re-enter the address of the client browser, he will find 192.168.1.100 this server, and then according to the port will find the Apache server. Apache He will put the code in the index.html in a directory through the URL address in the browser returned to the client, and then the browser will be based on the returned code to parse into the content of the page we see. This is where we visit the code of the page. What if we were to access a PHP file?
For example, in the client browser input He also sends back this address to 192.168.1.100 in Apache, Apache See you pass the PHP file, if the server is not loaded with PHP, he will open the file, the inside of the code is returned to the client, but the client browser he can not solve Analysis of PHP files. So the front desk will show this file code all, or a download of this file situation. This situation is not what we want to see. So we need to install a PHP service on the server side, so that Apache look at the php file you sent, it will pass the file to the PHP program, the PHP program first to explain the file. Then he returns to Apache, while Apache returns to the client. This allows the client to see the PHP file after parsing the page effect.
These are the roles and processes that Apache server and PHP play in the client's tour of a PHP page.
PHP and Apache's relationship and role for everyone, I hope that friends after reading this article can have some gains.