Project with PHP development, in the production process, it should be a period of time to monitor the running state of PHP script, which PHP process speed is too slow, what error log. Q: How do I check for slow-detection PHP scripts? A: Check the php-fpm slow log.
1. First find the configuration file to store the address
Find/-name php-fpm.conf
Vi/usr/servers/php/etc/php-fpm.conf
Open to see if your slow log is turned on, or where the slow log
Question: Online some say, fastcgi is a protocol, PHP-FPM realize this agreement, some say, PHP-FPM is fastcgi process Manager, used to manage the fastcgi process; some say, PHP-FPM is a patch of PHP kernel; Some say, after modifying the php.ini configuration file, there is no way to smooth the restart, so the birth of php-fp
Today I will introduce to you about php-fpm process close and restart command, PHP-FPM is a PHP FastCGI manager, is only for PHP and PHP5.3.3 has integrated php-fpm, it is no longer a third-party package.
Let's first understand what is php-fpm
The PHP-FPM is a PHP FastCGI ma
In the PHP-FPM to set up chroot, has a good isolation function, improve the system security, but to establish a reasonable PHP-FPMChroot environment is a little difficult, than the use of debootstrap and other tools to build more trouble, this article
In the PHP-FPM to set up chroot, has a good isolation function, improve the security of the system, but to establish a reasonable PHP-
This article introduces the content is about CGI, fastcgi, php-cgi, PHP-FPM analysis, has a certain reference value, now share to everyone, the need for friends can refer to
Defined
First of all, what does CGI do? CGI is designed to ensure that the data passed by the Web server is in a standard format and facilitates the writer of CGI programs.
Web server, such as Nginx, is simply the publisher of the content. For example, if the request /index.ht
With the common use of PHP scripting language, the current Webserice services are mostly in the structure of nginx+ (PHP-FPM), understand the work process before they can do in all aspects of the adjustment optimization and troubleshooting, from the following points to summarize this model.First, the relationship between Nginx and php-fpm and the division of LaborNginxis aWebServer,php-fpmis aphpfastcgiproc
[07-Dec-2015 17:07:08] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root[07-Dec-2015 17:07:08] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
Check php-fpm the log to find the above hint, try to change php-fpm user and group Modify the current user to match,
What is PHP-FPMPHP-FPM is a PHPFastCGI manager, is only for PHP, PHP-FPM is actually a patch of PHP source code, designed to integrate FastCGI process management into PHP package. You must patch it to your PHP source code before it can be used after compiling and installing PHP .... SyntaxHig
What is PHP-FPMPHP-FPM is a PHP FastCGI manager that is only used for P
PHP 5.3.3 Source In the beginning contains php-fpm, do not specifically re-patched, just to solve the source code directly configure, about the php-fpm of the compilation parameters? ENABLE-FPM? With-fpm-group=www? with-libevent-dir=libevent position.
This php-fpm no longe
, there will be a network delay, usually network normal situation, need about 100ms, The final request for a Dynamic Web page is approximately 200ms (ideally) accessible to the user's browser (just an HTML structure).Resource allocation1) PHP-FPM Process numberAs described above, concurrency of 5000 per second, each request completed about 200MS (specific page to be specific analysis, here is only an ideal value), if only 5 PHP application server, the
and execute the following command
Copy Code code as follows:
sudo chmod +x/etc/init.d/nginx
Sudo/sbin/chkconfig Nginx on
# Check it out #
Sudo/sbin/chkconfig--list Nginx
Nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Complete! You can use the following command to manage Nginx
Copy Code code as follows:
Service Nginx Start
Service Nginx Stop
Service Nginx Restart
Service Nginx Reload
/etc/init.d/nginx start
/etc/init.d/nginx stop
/etc/
Correctly set PHP-FPM child process user to improve website security prevent being hanged Trojan
Core Summary: The user that thephp-fpm child process uses cannot be the site file owner. Any violation of this principle does not conform to the principle of least privilege.
?
based on continuous feedback from the production environment, we found PHP website is hung Trojan, most of the reason is because the
Use unixsocket or TCP for communication between nginx and php-fpm and Its Configuration
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-cgi.sock using unix domain Socket (many tutori
This article introduces to you through the PHP-FPM implementation of performance optimization configuration method and considerations, the need for small partners can refer to the following
Brief introduction:
PHP-FPM is a PHP FastCGI manager, General Nginx above the PHP program will throw PHP program to PHP-FPM to parse. All right, that's it!
PHP 5.4 began to i
Two kinds of process management modes of PHP-FPMThe number of PHP-FPM processes can also be divided according to the settings
Dynamic and StaticOf
One is to directly open the specified number of PHP-FPM processes, no longer increase or decrease;
The other is to start a certain number of php-fpm process, when the request is large, dynamically increase the number o
What is PHP-FPMPHP-FPM is a PHP FastCGI manager that is only used for PHP,PHP-FPM is actually a patch of PHP source code, designed to integrate FastCGI process management into the PHP package. You must patch it to your PHP source code before using it after compiling and installing PHP.Now we can download the source code tree in the latest PHP 5.3.2 to directly integrate the branch of the PHP-
The installation of Apache and MySQL is the same as the previous part; please follow it for installation;Version Info: apache-2.4.4, php-5.4.13second, Compile and install php-5.4.131. Resolve Dependencies:#yum-y groupinstall "X Software development"If you want to have the compiled PHP support MCrypt extension, you need to download two RPM packages and install Them.Libmcrypt-2.5.7-5.el5.i386.rpmlibmcrypt-devel-2.5.7-5.el5.i386.rpmmhash-0.9.9-1.el5.centos.i386.rpmmhash-devel-0.9.9-1.el 5.centos.i3
original; PHP FCGI (5.2.2+). Makes sense is only with a TCP listening socket. each address; Must is separated by a comma. If This value is the left blank, connections'll be; Accepted from any IP address.; Default Value:anylisten.allowed_clients = 127.0.0.1; Specify the Nice (2) priority to apply to the pool processes (only if set); The value can vary from-19 (highest) to (lower); Note:-It would work if the FPM master process is launched as root
Reference website:Https://www.fujieace.com/php/php-fpm.htmlHttps://www.fujieace.com/php/pm-max_children-2.htmlHow big is the Pm.max_children?The php-fpm.conf has two key parameters:One is "max_children" and the other is "request_terminate_timeout".Pm.max_children represents the maximum number of child processes that PHP-FPM can start.Request_terminate_timeout indicates that a process that takes a long time to execute is terminated directly.The value o
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.