In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "the operation of PHP and the principle of multi-person development environment". In the daily operation, I believe that many people have doubts about the operation of PHP and the principle of multi-person development environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the operation of PHP and the principle of multi-person development environment". Next, please follow the editor to study!
Operation principle of PHP
First of all, let's analyze the operation principle of PHP and look at the language features of PHP. When we initiate a request from a browser and our web server (Nginx, Apache, etc.) listens on port 80 or 443, let's take a look at the simplest vhost configuration for Nginx:
Server {listen 80; server_name test.com; root / data/gateway/html; index index.php; location ~\ .php$ {fastcgi_pass 127.0.0.1 server_name test.com; root 9001; # unix:/Users/run/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}}
Nginx listens to port 80 and uses the corresponding vhost configuration when the domain name accessed by the user is test.com. PHP-FPM starts a service in the server, listens on a port (such as 9001) or a unix socket,Nginx through fastcgi_pass configuration, and passes the request to PHP-FPM to parse the PHP code. Each time, the PHP parser starts parsing from index.php, processes all the way, does a series of logical processing, queries the database or caches, and returns a HTML or other results to Nginx,Nginx and then to the browser. The process is shown in the following figure:
CGI: a protocol for data exchange between Nginx and PHP_FPM.
FastCGI: with CGI, it is a communication protocol, but it does some optimization in efficiency than CGI.
PHP-CGI: it is the interface program of CGI protocol provided by PHP to Nginx.
PHP-FPM: it is the interface program of PHP to FastCGI protocol provided by Nginx, and it also provides some relatively intelligent task management.
Multi-person development environment
From the principle of PHP, we can see that PHP is actually just an interpreted scripting language, and every request has to be parsed from index.php, so can we name many folders on the server according to the names of different developers, in their respective folders, clone good code repositories, and switch to their own branches? Then let Nginx handle the index under everyone's directory. For example, directly access http://wulv.test.com/, get wulv in Nginx, and set root to the wulv directory, so you can access the code in the wulv directory. You can set Nginx to do this:
Set $who www;if ($http_who! = "") {set $who $http_who;} root / data/gateway/$who/html
We can have the user's directory in URL, intercept it in Nginx, and carry it in the following places:
Host: http://wulv.test.com
Path: http://www.test.com/wulv
Query: http://www.test.com?http_who=wulv
In this way, the requirements can generally be achieved, but there are still some problems. For example, some links on the page are written dead and do not use a relative path, and you go to www.test.com as soon as you click, or some third-party applications, such as OAuth, need to verify the domain name, and you cannot log in if you are not consistent with the online domain name. So it needs to be done in other ways, such as:
Http request header
Cookie
We can use Modify Headers as a browser plug-in, modify the http request header information, set a parameter http_who to wulv, and then get it in Nginx.
At this point, the study of "the operation of PHP and the principle of multi-person development environment" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.