Php-fpm process shutdown and restart script details, php-fpm details _ PHP Tutorial

Source: Internet
Author: User
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 is actually PHP source code of the php-fpm process closed 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 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-FPM, it is said that the next version will be integrated into the main branch of PHP. Compared with Spawn-FCGI, PHP-FPM has better control over CPU and memory, and the former is easy to crash and must be monitored with crontab, while PHP-FPM has no such troubles.

PHP5.3.3 has already integrated php-fpm and is no longer a third-party package. PHP-FPM provides a better PHP process management method, can effectively control the memory and process, can smoothly load PHP configuration, than spawn-fcgi has more advantages, so it is officially included by PHP. You can enable PHP-fpm with The-enable-FPM parameter in./configure. Use PHP-FPM to control FastCGI processes of PHP-CGI
(Www.111cn.net)
The master process can understand the following signals:

INT, TERM terminated immediately
QUIT smooth termination
USR1 re-open the log file
USR2 smoothly reloads all worker processes and reloads configuration and binary modules.

Example:

Disable php-fpm:

The code is as follows:
Kill-INT 'cat/usr/local/php/var/run/php-fpm.pid'

Php-fpm restart:

The code is as follows:
Kill-USR2 'cat/usr/local/php/var/run/php-fpm.pid'

View the number of php-fpm processes:

The code is as follows:
Ps aux | grep-c php-fpm

Restart php-fmp (Method 2)

Run

The code is as follows:
Killall php-fpm

Run the command again (usr/local/php is the php installation directory)

The code is as follows:
/Usr/local/php/sbin/php-fpm &

From: http://www.111cn.net/phper/php-gj/52906.htm


Windows2003 how timed restart PHP-CGI

The stupid way is to write a batch processing, then write the above startup method into the batch processing, and then start the batch processing regularly in the task plan.
You can first use taskkill/f/im php-cgi.exe to kill php-cgi before starting, and then RunHiddenConsole.exe php \ php-cgi.exe-B 127.0.0.1: 9000-c php \ php. ini
 

Automatically restart the php service using shell scripts

#! /Bin/bash
If [(top | grep php | cut-d-f 9)-gt $1]; then
Sudo/data/webserver/php-5.2.17/sbin/php-fpm reload-u ×-p ×;
Fi
PS: replace $1 with the load value you want to monitor. for example, if you want the cpu usage of fpm to not exceed 10%, replace $1 with 10.
 

Idea first to understand what is php-fpm PHP-FPM is a PHP FastCGI manager that is only used for PHP. PHP-FPM is actually PHP source code...

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.