PHP-FPM use notes after PHP compile installation

Source: Internet
Author: User
Tags fpm ini


Today caught the 123System OPenVZ VPS Full-price opportunity, purchased a 512MB memory, dual-core 3.49Ghz Xeon e3-1270 V3 CPU package, this is the first time to use 123system products, the overall impression is very good, At present speed is also the leverage, then manually configured the latest version of Tengine and PHP 5.6.8. After compiling, I decided to run PHP in a php-fpm way, and here are some tips on how to use FPM, collected and collated from all over the area, and make a note of your friends who are in contact with some of the usual work.

1, after installation, the modification of the php-conf:
To modify a user group:

user = Www-data
Group = Www-data
If the Www-data user does not exist, then execute the Linux command to add the Www-data user first

Groupadd Www-data
Useradd-g Www-data Www-data
Partial parameter resolution:

PID = Run/php-fpm.pid
#pid设置, the default var/run/php-fpm.pid in the installation directory, recommended to open

Error_log = Log/php-fpm.log
#错误日志, default Var/log/php-fpm.log in the installation directory

Log_level = Notice
#错误级别. Available levels are: alert (must be processed immediately), error (Errors), warning (warning condition), notice (general important information), debug (debug information). Default: Notice.

Emergency_restart_threshold = 60
Emergency_restart_interval = 60s
#表示在emergency_restart_interval所设值内出现SIGSEGV或者SIGBUS错误的php-cgi Number of processes if more than Emergency_restart_threshold, PHP-FPM will gracefully restart. These two options generally keep the default values.

Process_control_timeout = 0
#设置子进程接受主进程复用信号的超时时间. Available units: s (seconds), M (minutes), H (Hours), or D (day) default units: S (sec). Default value: 0.

Daemonize = yes
#后台执行fpm, the default value is yes, if you want to change to no for debugging. In FPM, you can use different settings to run multiple process pools. These settings can be set individually for each process pool.

Listen = 127.0.0.1:9000
#fpm监听端口, that is, the address of PHP processing in Nginx, the general default value can be. Available formats are: ' Ip:port ', ' Port ', '/path/to/unix/socket '. Each process pool needs to be set.

Listen.backlog =-1
#backlog数, 1 means no limit, and the operating system decides that this row is commented out. Backlog meaning reference: http://www.3gyou.cc/?p=41

Listen.allowed_clients = 127.0.0.1
#允许访问FastCGI进程的IP, set any to not restrict IP, if you want to set other host Nginx also can access this FPM process, listen to set the cost of access to IP. The default value is any. Each address is separated by commas. Allow any server to request a connection if it is not set or is empty
2, the nginx.conf of the fastcgi part of the modification:

Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
3, PHP-FPM start related parameters

#测试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

#启动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

#关闭php-FPM
Kill-int ' Cat/usr/local/php/var/run/php-fpm.pid '

#重启php-FPM
KILL-USR2 ' Cat/usr/local/php/var/run/php-fpm.pid '
4. Opening and closing of Nginx

End Process: Fuser-k 80/tcp
Start Nginx:sudo/usr/local/nginx/nginx

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.