A detailed explanation of the relationship and role of PHP and Apache

Source: Internet
Author: User
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, because the domain name address default port is 80 port, so the final resolved address is: 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 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 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.

Related 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.