In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to achieve the coexistence of multiple versions of PHP connected to CentOS and Apache, the content is very detailed, interested friends can refer to, hope to be helpful to you.
The implementation of the multi-version coexistence scheme of PHP connected with Apache under CentOS, and gives some instructions on the configuration of mod_fcgi module.
Php-fpm, which integrates fastCGI mode under apache, seems to have few relevant materials on the Internet, even the English version. As long as it is php-fpm, it is basically paired with nginx. Check a large number of related materials, write this article to sum up.
There are several fastCGI support schemes under apache: at least mod_fcgi, mod_fastcgi (git), mod_proxy_fcgi and so on. Both of these modules are a bit old, especially since mod_fastcgi has not been updated since 2007, leaving it aside, in fact, it has not been used. The mod_proxy_fcgi module is officially introduced in the version of httpd 2.4 + through a concise line of ProxyPassMatch instructions.
Mod_fcgi
The mod_fcgi module itself is managed by the fastCGI process, so there is no need to use php-fpm to manage the process. Core configuration parameters
The directory where LoadModule fcgid_module modules/mod_fcgid.so DocumentRoot "/ var/www/html/site_1" ServerName "www.yourhost.com" DirectoryIndex index.html index.php # php.ini is stored. Under Linux, there is usually no need for # FcgidInitialEnv PHPRC "D:/php" # to set PHP_FCGI_MAX_REQUESTS greater than or equal to FcgidMaxRequestsPerProcess. Prevent php-cgi processes from exiting FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 # php-cgi maximum number of requests per process FcgidMaxRequestsPerProcess 1000 # php-cgi maximum number of processes FcgidMaxProcesses 3 # maximum execution time FcgidIOTimeout 600 FcgidIdleTimeout 600 # php-cgi path FcgidWrapper / usr/local/php7/bin/php-cgi .php AddHandler fcgid-script .php FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000 Options + ExecCGI before all requests are processed
Several Fcgid* instructions are used for optimization. Here is only an example, and the value should be adjusted according to the actual situation. For more information, please see the mod_fcgi official documentation.
Several characteristics of using mod_fcgid
The php-fgi process is started and managed by the apache module, and there is no need to configure php-fpm
When the php-cig process runs as the apache user, the files written by the php program have permissions for the apache user (unlike php-fpm, which is owned by the php-fpm user and the default is nobody), which is more consistent in directory rights management.
Mod_fastcgi
Although apache 2.2 is available under CentOS 6.x, fortunately some people have successfully transplanted it: https://github.com/ceph/mod-proxy-fcgi can be used directly; luckily, it has entered the epel source and can be installed directly with yum; if you don't want to match the Epel source, you can download the rpm package and install it directly (sample http://mirrors.ustc.edu.cn/epel/6/x86_64/)
Of course, you can recompile and install apache 2.4, so that mod_proxy_fcgi can be used directly, but here the original version remains the same, saving the compilation workload.
Refer to mod_proxy_fcgi official documentation and integrate php-fpm configuration instructions
ProxyPassMatch "^ / myapp/.*\ .php (/. *)? $" fcgi://localhost:9000/var/www/ http://www.bbqmw.net/qm_zyqm/"
The syntax is simple, similar to configuring a reverse proxy, and can be modified as needed. In fact, it is consistent with the syntax of the mod_proxy module, except that it changes the http protocol to the fcig protocol.
The above is the fastCGI running in apache integrated php-fpm mode. Next, you need to make some configuration changes to the php installed by yum.
The php configuration file / etc/httpd/conf.d/php.conf for yum installation, with the following line
AddHandler php5-script .php
We want to enable different php for different sites, the above line is for the global .php file assigned to the php module processing, we comment out this line. Instead, a different php operation mode is enabled at each site.
On how to achieve CentOS and Apache connection of PHP multi-version coexistence is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.