linux-lnmp-php-fpm

Source: Internet
Author: User
Tags curl

LINUX-LNMP-PHP-FPM

    • The pool of PHP-FPM
    • PHP-FPM Slow Execution Log
    • Open_basedir
    • PHP-FPM Process Management

The pool of PHP-FPM
Define a pool of multiple php-fpm

Define multiple pool in the/usr/local/php-fpm/etc/php-fpm.conf file. Each defined pool name is different, and the listener sock or ip:port in each pool should be different, In the corresponding Nginx virtual host also to modify the listening sock or ip:port.

vim /usr/local/php-fpm/etc/php-fpm.conf //在[global]部分增加include = etc/php-fpm.d/*.confmkdir /usr/local/php-fpm/etc/php-fpm.d/vim /usr/local/php-fpm/etc/php-fpm.d/analysis.conf[analysis]listen = /tmp/analysis-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024

Slow execution log for PHP-FPM

vim /usr/local/php-fpm/etc/php-fpm.d/default.conf  //增加如下两行request_slowlog_timeout = 1slowlog = /usr/local/php-fpm/var/log/default-slow.loggrep listen /usr/local/php-fpm/etc/php-fpm.d/default.conf //以下两行是查出的内容listen = /tmp/php-fcgi.socklisten.mode = 666grep fastcgi_pass /usr/local/nginx/conf/vhost/default.conf  //以下是查询得出的结果fastcgi_pass unix:/tmp/php-fcgi.sock;

Add Test page

vim /data/wwwroot/default/slow.php //以下是文件内容<?php    echo "start";    sleep(2);    echo "end";?>

Test, check the log

 curl -x127.0.0.1:80 www.default.com/slow.php cat /usr/local/php-fpm/var/log/default-slow.log  //以下是日志信息 [02-Mar-2018 10:04:20]  [pool default] pid 49346script_filename = /data/wwwroot/default/slow.php[0x00007fc9e507f280] sleep() /data/wwwroot/default/slow.php:3

Open_basedir
Edit Php[pool] 's configuration file

vim /usr/local/php-fpm/etc/php-fpm.d/default.conf  //加入以下内容php_admin_value[open_basedir]=/data/wwwroot/default:/tmp

Reload the configuration file before testing

/etc/init.d/php-fpm reload curl -x127.0.0.1:80 www.default.com/slow.php

linux-lnmp-php-fpm

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.