Php-fpm startup

Source: Internet
Author: User
Tags http 200
Php-fpm startup ?????? Php5.3.3 the source code starts to contain php-fpm. you don't need to fix it any more. you just need to unlock the source code and directly configure it, for php-fpm compilation parameters,-enable-fpm-with-fpm-user = www-with-fpm-group = www php-fpm is enabled.

?????? Php 5.3.3 source code starts to contain php-fpm and does not need to be patched. you only need to solve the source code and directly configure it, the compiling parameters for php-fpm include-enable-fpm-with-fpm-user = www-with-fpm-group = www-with-libevent-dir = libevent.

?

This php-fpm does not support commands such as/usr/local/php/sbin/php-fpm (start | stop | reload) with the php-fpm patch. signal control is required:

?

The master process can understand the following signals:

?

SIGINT, SIGTERM terminated immediately
SIGQUIT ends smoothly
SIGUSR1 re-open the log file
SIGUSR2 smoothly reloads all worker processes and reloads configuration and binary modules.

?

Example:
Disable php-fpm:
Kill-SIGINT 'cat/usr/local/php/var/run/php-fpm.pid'
Php-fpm restart:
Kill-SIGUSR2 'cat/usr/local/php/var/run/php-fpm.pid'

?

Second, the configuration file is no longer in xml format and changed to INI, but the configuration parameters are almost the same as before. you can refer to the xml format configuration.

?

------ Supplementary content ------
Php-fpm startup:

?

Cp-f (php-5.3.x-source-dir)/sapi/fpm/init. d. php-fpm/etc/init. d/php-fpmchmod 755/etc/init. d/php-fpm/etc/init. d/php-fpm start/sbin/chkconfig -- add php-fpm (add to startup service list)/sbin/chkconfig php-fpm on

?

Start, stop, and restart php-fpm:
/Etc/init. d/php-fpm start
/Etc/init. d/php-fpm stop
/Etc/init. d/php-fpm reload

---- Refer to http://ideas.spkcn.com/technology/php-technology/133.html -------------------------------------------

?

?

?

Specify directories
/Usr/local/php/sbin/php-fpm
/Usr/local/php/etc/php-fpm.conf
/Usr/local/php/etc/php. ini

?

?

# Test php-fpm configuration/usr/local/php/sbin/php-fpm-t/usr/local/php/sbin/php-fpm-c/usr/local/php /etc/php. ini-y/usr/local/php/etc/php-fpm.conf-t # start php-fpm/usr/local/php/sbin/php-fpm/usr/local/php/sbin /php-fpm-c/usr/local/php/etc/php. ini-y/usr/local/php/etc/php-fpm.conf # close php-fpmkill-INT 'cat/usr/local/php/var/run/php-fpm.pid '# restart php-fpmkill -USR2 'cat/usr/local/php/var/run/php-fpm.pid'

?

2. detailed explanation of important parameters of php-fpm.conf

?

Pid = run/php-fpm.pid # pid settings, default var/run/php-fpm.pid in the installation directory, it is recommended to enable error_log = log/php-fpm.log # Error log, default var/log/php-fpm.log log_level = notice # Error level in the installation directory. available level: alert (must be handled immediately), error (error), warning (warning), notice (important information), debug (debugging information ). default value: notice. expiration = 60emergency_restart_interval = 60 s # indicates that the number of php-cgi processes with SIGSEGV or SIGBUS errors within the value set by emergency_restart_interval exceeds that of emergency_restart_threshold., Php-fpm will be restarted elegantly. These two options are generally kept by default. Process_control_timeout = 0 # set the timeout time for the sub-process to receive the multiplexing signal of the main process. available unit: s (seconds), m (minutes), h (hours), or d (days) default unit: s (seconds ). default value: 0. daemonize = yes # fpm is executed in the background. the default value is yes. you can change it to no for debugging. In FPM, you can use different settings to run multiple process pools. These settings can be set separately for each process pool. Listen = 127.0.0.1: 9000 # fpm listening port, that is, the address processed by php in nginx. Generally, the default value is enough. Available Formats: 'Ip: port', 'port', '/path/to/unix/socket '. each process pool needs to be set. listen. backlog =-1 # Number of backlogs.-1 indicates no limit. this parameter is determined by the operating system and can be commented out. For details about backlog, refer: http://www.3gyou.cc/?p=41 Listen. allowed_clients = 127.0.0.1 # allow access to the IP address of the FastCGI process. set any to an unlimited IP address. if you want to set nginx of other hosts, you can also access this FPM process, set the IP address that can be accessed at a cost in listen. The default value is any. Each address is separated by a comma. if it is not set or empty, any server is allowed to request connection to listen. owner = wwwlisten. group = wwwlisten. mode = 0666 # unix socket setting options. if you use tcp access, comment it out here. User = wwwgroup = www # account for starting the process and group pm = dynamic # for dedicated servers, pm can be set to static. # The options for controlling sub-processes include static and dynamic. If static is selected, a fixed number of sub-processes is specified by pm. max_children. If dynamic is selected, it is determined by the following parameters: pm. max_children #, maximum number of child processes pm. start_servers #, number of processes at startup pm. min_spare_servers # ensures the minimum number of idle processes. if the number of idle processes is smaller than this value, a new sub-process pm is created. max_spare_servers # ensures the maximum number of idle processes. if the number of idle processes exceeds this value, clean pm. max_requests = 1000 # set the number of service requests before each sub-process is reborn. it is very useful for third-party modules that may have memory leaks. if it is set to '0', the request is always accepted. equivalent to the PHP_FCGI_MAX_REQUESTS environment variable. default value: 0. pm. status_path =/status # FPM status page URL. if not set, the status page cannot be accessed. default value: none. munin monitoring uses ping. path =/ping # FP The ping URL of the M monitoring page. if it is not set, the ping page cannot be accessed. this page is used to check whether FPM is alive and can respond to requests. Note that it must start with a slash (/). Ping. response = pong # defines the response of ping requests. returns the text in the text/plain format of HTTP 200. default value: pong. request_terminate_timeout = 0 # set the timeout duration of a single request. this option may apply to php. the 'max _ execution_time 'in ini settings is not useful for stopping the running script for some special reasons. set to '0' to 'off '. you can try to change this option when 502 errors occur frequently. Request_slowlog_timeout = 10 s # When a request times out, the corresponding PHP call stack information is completely written to the slow log. set '0' to 'off' slowlog = log/$ pool. log. slow # slow Request Logging, used with request_slowlog_timeout to use rlimit_files = 1024 # set the rlimit limit of the file opening descriptor. default value: the default value of the system defined value is 1024. you can use ulimit-n to view and modify ulimit-n 2048. Rlimit_core = 0 # set the maximum limit value of the core rlimit. available value: 'limited', 0, or positive integer. default value: System defined value. chroot = # The Chroot directory at startup. the defined directory must be an absolute path. if not set, chroot is not used. chdir = # set the Startup directory, which will be automatically Chdir to the directory at startup. the defined directory must be an absolute path. default value: the current directory or/Directory (for chroot) catch_workers_output = yes # Redirects stdout and stderr during running to the main error log file. if not set, stdout and stderr will be redirected to/dev/null according to FastCGI rules. default value: Null.

? Reference: http://www.4wei.cn/archives/1002061

?

?

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.