Recently, a colleague has a guardianship requirement for the PHP-FPM process, i.e. if the master process of PHP-FPM quits unexpectedly (possibly crash, it could be a false kill), then the master process is expected to be pulled automatically to avoid interruption of service.
We know that supervisor is a very powerful process monitoring (monitor Control) tool that can theoretically implement the PHP-
Php-fpm process shutdown and restart script details, php-fpm details. Php-fpm process shutdown and restart script details, php-fpm details first to understand what is php-fpmPHP-FPM is a PHPFastCGI manager, is only used for PHP. PHP-FPM
PHP-FPM to achieve performance optimization, php-fpm Performance Optimization
Introduction:
PHP-FPM is a PHP FastCGI manager, the general Nginx above the run PHP program will be PHP program thrown to the PHP-FPM for parsing. Okay, that's it!
PHP 5.4 began to integrate the PHP-FPM
Php-fpm process shutdown and restart script details, php-fpm details
Let's first understand what is php-fpm
The PHP-FPM is a PHP FastCGI manager and is only for PHP.
PHP-FPM is actually a patch of PHP source code, designed to integrate FastCGI process management into the PHP
The recent 502 error of Nginx Gap, how to implement automatic restart PHP-FPM?
Think of the solution
1. Execute shell script with crontab timer, reboot after error (timed execution every 5 seconds)2. Using the Nohup,shell script background execution
Sample Script
#!/bin/bash while : do URL="http://192.168.1.30" RESULT=`curl -m 10 -I -s $URL | grep "HTTP/1.1 502"` if [ -n "$RESULT" ]; then /etc/init.d/php-
Download wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
2. Yum-y Install Nginx3. Service Nginx RestartSee WELCOME to NGINX instructions for installation success!4.yum-y Install PHP-FPM5. Let Nginx support PHP-FPMFind /etc/nginx/conf.d/default.conf, Open Edit It>vi/etc/nginx/conf.d/default.confRemove the comments from the following section to supportPHPScript:Location ~ \.php$ {root HTML;Fastcgi_pass 127.0.0.1:9000;Fastcgi_index index.php;Fast
Nginx communicates with php-fpm using unix socket or TCP, and its configuration, nginxphp-fpm
Preface
Nginx and fastcgi can communicate in either TCP or unix socke. The two methods have their own advantages and disadvantages. Here we first provide two configuration methods, and then summarize the performance and security.
TCP is to use TCP port to connect 127.0.0.1: 9000Socket is connected to socket/dev/shm
PHP-FPM process pool probing, php-fpm pool probing
PHP supports multi-process rather than multi-thread; PHP-FPM runs multiple sub-processes in the process pool to process all connection requests concurrently. View the PHP-FPM process pool (pm. start_servers = 2) status through ps as follows:
root@d856fd02d2fe:~# ps aux
The relationship between FastCgi and PHP-fpm, fastcgiphp-fpm
Web server (such as nginx) is only the content distributor. For example, if the request/index.htmlThe web server will find the file in the file system and send it to the browser. static data is distributed here. Okay, if the request is/index.phpAccording to the configuration file, nginx knows that this is not a static file and needs to be handled
Analysis of php-fpm static and dynamic execution methods, analysis of php-fpm
This article describes the comparison between static and dynamic execution methods of php-fpm. We will share this with you for your reference. The details are as follows:
Some time ago, when I configured php-fpm, I accidentally found that the
Relationship between nginx and php-fpm, nginxphp-fpm
People can perceive it, but the server cannot perceive it. We call it forward to the proxy server.
There is a server load proxy server in the center of Baidu for reverse proxy access.
This is not perceptible to people, but it is perceptible to servers. We call it a reverse proxy server.
Nginx is a high-performance http and reverse proxy server and an IMA
("Engine X") is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP proxy server.
Install the configuration on fedora17/16/15/14,centos6.2/6.1/6/5.8 and Red Hat (RHEL) 6.2/6.1/6/5.8 nginx/php-fpm
Let's get moving.
STEP1. Switch to the root user[Plain]Su-# # OR # #Sudo-i
STEP2. Installing the necessary software sources2-1. Installing Remi Source under Fedora 17/16/15/14[Plain]# # Remi Dependency on Fedora 17, 16, 15RPM-UVH http://
Difference between CGI, FastCGI, and php-fpm, cgifastcgiphp-fpmRefer to the online description to organize the online description:First, what does CGI do? CGI is used to ensure that the data transmitted by the web server is in the standard format, so that the compilation of CGI programs is convenient.Web server (such as nginx) is only the content distributor. For example, if you request/index.html, the web server will find the file in the file system
Nginx + php-fpm error 502 bad gateway solution, nginxphp-fpm
1. nginx error cannot be found. Generally, You need to modify/usr/local/nginx/conf/nginx. conf (careful modification may cause other website problems)
Error 2,502
Case 1: nginx fails:
Command:/usr/local/nginx/sbin/nginx-s reload
Wait a moment later
Case 2: php disconnection:
First you need to modify the parameters in the/usr/local/php-5.6.0/etc/ph
For php-fpm parameter settings, in many cases there is a doubt that the built-in parameters such as pm.max_children,pm.start_servers, such as the number of parameters such as how much this setting is appropriate. In fact, these parameters often depend on the current number of connections, and in most cases, it is difficult to determine whether the current number of connections to our PM and other parameters are appropriate. So with the help of the PHP
For php-fpm parameter settings, in many cases there is a doubt that the built-in parameters such as pm.max_children,pm.start_servers, such as the number of parameters such as how much this setting is appropriate. In fact, these parameters often depend on the current number of connections, and in most cases, it is difficult to determine whether the current number of connections to our PM and other parameters are appropriate. So with the help of the PHP
Haven't written a blog for a long time, because there is nothing to write.The reason why this question, because read a Daniel article: PHP upgrade caused by high system load problem analysis. After reading, some of the text triggered my idea, also want to verify.Scheme, grab the packet with tcpdump, get the system call with Strace8080 9000 0 -w Temp8080 is the Nginx service port, 9000 is the port of the PHP-FPM service, grasping these two ports is to
Use the php-fpm status page to observe the current php-fpm status.For php-fpm parameter settings, in many cases, there are several built-in parameters, such as pm. max_children, pm. start_servers and so on. In fact, these parameters often depend on the current number of connections. In most cases, it is difficult to determine whether the current number of connect
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.