一、php-fpm的pool;php
在php-fpm裏面有一個概念,叫作pool,使用ps aux|grep php-fpm最右側的那一列就是pool,也就是它的池子;html
[root@localhost_001 vhost]# ps aux |grep php-fpm root 1072 0.0 0.2 227240 4948 ? Ss 09:31 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 1073 0.0 0.2 227240 4704 ? S 09:31 0:00 php-fpm: pool www php-fpm 1074 0.0 0.2 227240 4704 ? S 09:31 0:00 php-fpm: pool www php-fpm 1075 0.0 0.2 227240 4704 ? S 09:31 0:00 php-fpm: pool www php-fpm 1076 0.0 0.2 227240 4704 ? S 09:31 0:00 php-fpm: pool www php-fpm 1077 0.0 0.2 227240 4708 ? S 09:31 0:00 php-fpm: pool www php-fpm 1078 0.0 0.2 227240 4708 ? S 09:31 0:00 php-fpm: pool www php-fpm 1079 0.0 0.2 227240 4708 ? S 09:31 0:00 php-fpm: pool www php-fpm 1080 0.0 0.2 227240 4708 ? S 09:31 0:00 php-fpm: pool www [root@localhost_001 vhost]# ps aux |grep php-fpm |grep -v 'grep'|wc -l 21
2:切換目錄,會看到咱們只定義了一個www的pool;nginx
註釋:實際上是支持定義多個池子的,每個池子能夠監聽不一樣的sock和IP地址,nginx有多個站點的時候,每一個站點去使用一個獨立的pool;apache
站點分開使用pool的優點:當其中一個php發生了502錯誤(有多是資源不夠了),若是全部的站點共同使用了一個pool池子,那麼當其中一個網站發生了故障(可能寫的程序有問題),會把你的php的資源耗盡,這樣會形成其餘站點也會502,因此有必要把每一個站點隔離開來,每個站點使用獨立的pool; 請求過多,資源耗盡;vim
設置多個pool的方法以下;瀏覽器
(1):在/usr/local/php-fpm/etc/php-fpm裏繼續增長第二個pool; test 以下:安全
[root@localhost_001 etc]# cat php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock #listen = 127.0.0.1:9000 #listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 [test] #定義的第二個pool池子; listen = /tmp/test.sock #經過監聽的sock來區分; user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
註釋:如上圖例:咱們自定義名稱:test 自定義監聽方式爲 listen = /tmp/test.sockbash
3:而後檢測php-fpm 並從新啓動服務;服務器
[root@localhost_001 etc]# /usr/local/php-fpm/sbin/php-fpm -t [06-Nov-2018 12:37:27] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost_001 etc]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
4:這是再使用ps aux|grep php-fpm 查看,會發現右側多了 test 的 pool 的池子;curl
[root@localhost_001 etc]# ps aux |grep php-fpm root 3750 0.0 0.2 123708 4968 ? Ss 12:37 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 3751 0.0 0.2 123648 4700 ? S 12:37 0:00 php-fpm: pool www php-fpm 3752 0.0 0.2 123648 4700 ? S 12:37 0:00 php-fpm: pool www php-fpm 3753 0.0 0.2 123648 4700 ? S 12:37 0:00 php-fpm: pool www php-fpm 3754 0.0 0.2 123648 4700 ? S 12:37 0:00 php-fpm: pool www php-fpm 3755 0.0 0.2 123648 4704 ? S 12:37 0:00 php-fpm: pool www php-fpm 3787 0.0 0.2 123648 4712 ? S 12:37 0:00 php-fpm: pool test php-fpm 3788 0.0 0.2 123648 4712 ? S 12:37 0:00 php-fpm: pool test php-fpm 3789 0.0 0.2 123648 4716 ? S 12:37 0:00 php-fpm: pool test php-fpm 3790 0.0 0.2 123648 4716 ? S 12:37 0:00 php-fpm: pool test [root@localhost_001 etc]# ps aux |grep php-fpm|grep test|wc -l 20
註釋:當時主進程仍是隻有1個的;
5:在nginx配置裏用另外一個站點使用新的pool池子;
[root@localhost_001 etc]# cd /usr/local/nginx/conf/vhost/ [root@localhost_001 vhost]# ls aaa.com.conf ssl.conf test.com.conf
註釋:如上圖例,咱們有兩個站點; aaa.com test.com.conf
1:test.com.conf使用是www的pool,經過以下配置來指定使用哪一個pool;
#fastcgi_pass unix:/tmp/php-fcgi.sock; #經過指定/tmp/下的通訊sock來決定使用哪一個pool池子;
[root@localhost_001 vhost]# cat test.com.conf server { listen 80; server_name www.test.com bbs.test.com test1.com; index index.html index.htm index.php; root /data/wwwroot/test.com; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/php-fcgi.sock; #指定使用php-fcgi的pool池子;##寫錯這個路徑,就會顯示502 # fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/wwwroot/test.com$fastcgi_script_name; } access_log /tmp/test.com.log combined_realip; }
2:設置aaa.com來使用以前定義好的pool池子test;
[root@localhost_001 vhost]# vim aaa.com.conf server { listen 80 default_server; # 有這個標記的就是默認虛擬主機 server_name aaa.com; index index.html index.htm index.php; root /data/wwwroot/default; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/test.sock; #指定使用test的pool池子;##寫錯這個路徑,就會顯示502 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/wwwroot/test.com$fastcgi_script_name; } }
註釋:如上圖例,這樣兩個站點就隔離開了;
註釋:假設www.test.com請求了很大,最終將php-fpm進程耗盡了,當有其餘的請求過來時,就會報502錯誤,由於沒有多餘的php-fpm提供服務了,而另外一個站點aaa.com則不受影響,由於使用的是另外一個pool池子(test),這就是須要定義多個池子的緣由了;
6:方法二,在/usr/local/php-fpm/etc/php-fpm寫入include vhost/*.conf,而後vhost下分別寫入多個pool池子,其他配置不變;
註釋:這裏的配置和nginx的虛擬主機的用法是同樣子的;
1:首先把在配置文件/usr/local/php-fpm/etc/php-fpm裏global里加入以下一行;將其餘池子的內容都刪除; 100dd ---> 快速刪除;
2:上圖例中定義include定義的是在etc/php-fpm.d/*.conf目錄下,全部還須要建立這個目錄;
[root@localhost_001 etc]# mkdir php-fpm.d [root@localhost_001 etc]# ls pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d php.ini
3:建立www.conf(即www.test.com的pool池子);
[root@localhost_001 php-fpm.d]# vim www.conf [www] listen = /tmp/php-fcgi.sock #listen = 127.0.0.1:9000 #listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
建立test.com(即aaa.com的pool池子);
[root@localhost_001 php-fpm.d]# vim test.conf [test] #定義的第二個pool池子; listen = /tmp/test.sock #經過監聽的sock來區分; user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
4:檢測是否有錯誤,並從新啓動php-fpm;
[root@localhost_001 php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t [06-Nov-2018 14:21:23] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost_001 php-fpm.d]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
5:用ps aux |grep php-fpm 查看是否正常;
[root@localhost_001 php-fpm.d]# ps aux |grep php-fpm root 3888 0.0 0.2 123708 4976 ? Ss 14:21 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 3889 0.0 0.2 123648 4704 ? S 14:21 0:00 php-fpm: pool test php-fpm 3890 0.0 0.2 123648 4704 ? S 14:21 0:00 php-fpm: pool test php-fpm 3891 0.0 0.2 123648 4704 ? S 14:21 0:00 php-fpm: pool test php-fpm 3892 0.0 0.2 123648 4704 ? S 14:21 0:00 php-fpm: pool test php-fpm 3893 0.0 0.2 123648 4708 ? S 14:21 0:00 php-fpm: pool test php-fpm 3894 0.0 0.2 123648 4708 ? S 14:21 0:00 php-fpm: pool test php-fpm 3921 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3922 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3923 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3924 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3925 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3926 0.0 0.2 123648 4716 ? S 14:21 0:00 php-fpm: pool www php-fpm 3927 0.0 0.2 123648 4720 ? S 14:21 0:00 php-fpm: pool www php-fpm 3928 0.0 0.2 123648 4720 ? S 14:21 0:00 php-fpm: pool www
三、php的慢執行日記;
在作php的網站,建議使用lnmp,方便分析php的慢執行日記;
查詢方法:系統負載,能夠經過各類工具查看,查出是那個進程致使的;
php的訪問慢:經過查看慢執行日記;
1:在php的pool池子中添加以下兩行; /usr/local/php-fpm/etc/php-fpm.d/www.conf
[root@localhost_001 php-fpm.d]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf [root@localhost_001 php-fpm.d]# cat www.conf [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 3新贈以下兩行; request_slowlog_timeout = 1 #慢執行超過1s後則記錄日記; slowlog = /usr/local/php-fpm/var/log/www-slow.log #慢執行日記記錄的位置在這裏;
2:檢測語法錯誤並從新加載配置文件;
[root@localhost_001 php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t [06-Nov-2018 14:36:27] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost_001 php-fpm.d]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
3:查看慢執行日記文件是否生成;
[root@localhost_001 php-fpm.d]# ls /usr/local/php-fpm/var/log/www-slow.log /usr/local/php-fpm/var/log/www-slow.log [root@localhost_001 php-fpm.d]# cat /usr/local/php-fpm/var/log/www-slow.log
註釋:日記爲空,由於沒有慢執行的記錄;
4:此時模擬慢執行的php,因此須要在/data/wwwroot/test下操做;
[root@localhost_001 php-fpm.d]# vim /data/wwwroot/test.com/sleep.php cat /data/wwwroot/test.com/sleep.php <?php echo 「test slow log」; sleep(2);echo 「done」; ?>
運行php腳本;未輸出任何信息,狀態碼限制500錯誤;
[root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/sleep.php -I HTTP/1.1 500 Internal Server Error Server: nginx/1.4.7 Date: Tue, 06 Nov 2018 06:42:01 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.30
5:查看錯誤日記,簡單的方法是在它的配置裏打開錯誤日記顯示,讓其顯示到瀏覽器上;
[root@localhost_001 php-fpm.d]# vim /usr/local/php-fpm/etc/php.ini display_errors = On [root@localhost_001 php-fpm.d]# service php-fpm start
再次用curl命令來查看; 顯示語法錯誤;有多是逗號 分號寫的不對;
[root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/sleep.php <br /> <b>Parse error</b>: syntax error, unexpected 'slow' (T_STRING), expecting ',' or ';' in <b>/data/wwwroot/test.com/sleep.php</b> on line <b>2</b><br />
再次查看其sleep.php 修改其標點符號;
[root@localhost_001 php-fpm.d]# vim /data/wwwroot/test.com/sleep.php <?php echo "test slow log"; sleep(2);echo "done"; ?> [root@localhost_001 php-fpm.d]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
5:再次測試,會看到訪問成功了,可是停頓了幾秒;
[root@localhost_001 php-fpm.d]# !curl curl -x127.0.0.1:80 www.test.com/sleep.php
6:再次查看是否生成了慢查詢日記;
[root@localhost_001 php-fpm.d]# cat /usr/local/php-fpm/var/log/www-slow.log [06-Nov-2018 14:53:00] [pool www] pid 4168 script_filename = /data/wwwroot/test.com/sleep.php [0x00007fbc55df1258] sleep() /data/wwwroot/test.com/sleep.php:3
註釋:這個是慢查詢日記的功能了,若是遇到php訪問慢的狀況,能夠經過此日記來查看;
註釋:在/usr/local/php-fpm/etc/php-fpm.d/www.conf裏定義的內容:request_slowlog_timeout = 1 #後面的1設置慢執行日記的時間;
註釋:通常都設置爲2s,php的執行時間介於1到2秒之間;
三、php-fpm定義open_basedir:
做用:是限制php在指定的目錄內活動;也爲了安全;
由於服務器管理多個網站,在php.ini裏定義多個open_basedir就不合適了,因此要麼在apache的虛擬主機裏定義,要麼在php-fpm配置文件裏定義,咱們能夠針對不一樣的池子去定義不一樣的open_basedir;
1:針對www.conf(pool池子爲www來設置):
[root@localhost_001 php-fpm.d]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 request_slowlog_timeout = 1 slowlog = /usr/local/php-fpm/var/log/www-slow.log php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
2:檢測並重啓php-fpm;
[root@localhost_001 php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t [06-Nov-2018 15:03:36] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost_001 php-fpm.d]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
3:訪問測試; curl -x127.0.0.1:80 www.test.com/2.php
[root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/2.php -I HTTP/1.1 200 OK Server: nginx/1.4.7 Date: Tue, 06 Nov 2018 07:04:47 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.30
註釋:若open_basedir路徑定義錯誤,就會致使沒法訪問,造成404的狀態碼,curl命令會顯示 「no input file specified」
[root@localhost_001 php-fpm.d]# vim www.conf [www] listen = /tmp/php-fcgi.sock ........ php_admin_value[open_basedir]=/data/wwwroot/default:/tmp/ [root@localhost_001 php-fpm.d]# service php-fpm restart #從新啓動php-fpm服務; Gracefully shutting down php-fpm . done Starting php-fpm done [root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/2.php No input file specified. [root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/2.php -I HTTP/1.1 404 Not Found Server: nginx/1.4.7 Date: Tue, 06 Nov 2018 07:18:48 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.30
4:定義錯誤日記; /usr/local/php-fpm/etc/php.ini
[root@localhost_001 etc]# vim php.ini ;搜索display_errors 並設置爲 Off,不讓錯誤日記輸出到瀏覽器上,不安全; display_errors = Off ;error_log = syslog ;定義錯誤日記存放路徑; error_log = /usr/local/php/var/log/php_error.log ;定義錯誤日記的級別; error_reporting = E_ALL ;error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT error_reporting = E_ALL #定義錯誤日記級別;
註釋:display_errors = Off 這個在線上是關閉的,不能讓別人經過你的瀏覽器信息看看php的錯誤,而是要把錯誤記錄到某個文件裏;
檢測並從新加載php-fpm的服務;
[root@localhost_001 etc]# /usr/local/php-fpm/sbin/php-fpm -t [06-Nov-2018 15:33:46] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful [root@localhost_001 etc]# service php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
5:手動建立php_error.log錯誤日記,並設置777,防止不能寫入;
[root@localhost_001 etc]# touch /usr/local/php-fpm/var/log/php_error.log [root@localhost_001 etc]# chmod 777 !$ chmod 777 /usr/local/php-fpm/var/log/php_error.log [root@localhost_001 etc]# ls -ld !$ ls -ld /usr/local/php-fpm/var/log/php_error.log -rwxrwxrwx 1 root root 256 11月 6 15:35 /usr/local/php-fpm/var/log/php_error.log
6:而後測試;再次用 curl 命令來訪問;
[root@localhost_001 etc]# curl -x127.0.0.1:80 www.test.com/2.php No input file specified. [root@localhost_001 etc]# curl -x127.0.0.1:80 www.test.com/2.php -I HTTP/1.1 404 Not Found Server: nginx/1.4.7 Date: Tue, 06 Nov 2018 07:36:41 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.30
7:查看錯誤日記信息; /usr/local/php-fpm/var/log/php_error.log
[root@localhost_001 etc]# tail /usr/local/php-fpm/var/log/php_error.log [06-Nov-2018 07:33:46 UTC] PHP Deprecated: Comments starting with '#' are deprecated in Unknown on line 2 in Unknown on line 0 [06-Nov-2018 07:33:55 UTC] PHP Deprecated: Comments starting with '#' are deprecated in Unknown on line 2 in Unknown on line 0 [06-Nov-2018 07:36:35 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/test.com/2.php) is not within the allowed path(s): (/data/wwwroot/default:/tmp/) in Unknown on line 0 [06-Nov-2018 07:36:35 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 [06-Nov-2018 07:36:39 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/test.com/2.php) is not within the allowed path(s): (/data/wwwroot/default:/tmp/) in Unknown on line 0 [06-Nov-2018 07:36:39 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 [06-Nov-2018 07:36:41 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/test.com/2.php) is not within the allowed path(s): (/data/wwwroot/default:/tmp/) in Unknown on line 0 [06-Nov-2018 07:36:41 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
8:而後修改open_basedir到原先的test.com目錄,而後再次訪問;
[root@localhost_001 php-fpm.d]# cat www.conf [www] listen = /tmp/php-fcgi.sock ........ php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/ [root@localhost_001 php-fpm.d]# service php-fpm restart #從新啓動php-fpm服務; Gracefully shutting down php-fpm . done Starting php-fpm done
9:而後再次用curl命令來訪問; curl -x127.0.0.1:80 www.test.com/2.php -I
</div></body></html>[root@localhost_001 php-fpm.d]# curl -x127.0.0.1:80 www.test.com/2.php -I HTTP/1.1 200 OK Server: nginx/1.4.7 Date: Tue, 06 Nov 2018 07:39:19 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.30
四、php-fpm進程管理; 配置介紹;;;
[root@localhost_001 php-fpm.d]# cat www.conf [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 request_slowlog_timeout = 1 slowlog = /usr/local/php-fpm/var/log/www-slow.log php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
pm = dynamic 表示進程以什麼形式啓動( dynamic| static ),dynamic就是動態啓動,動態就是一開始是一個數值,會根據需求來自動生成,服務器比較閒的時候還會去銷燬,銷燬到必定程度時還會去自動生成;
pm.max_children = 50 表示最大子進程數;(當設置成static後,則只有這一行會生效,下面的都不生效,會一次性生成50個子進程)
pm.start_servers = 20 啓動服務時會啓動的進程數; ps aux |grep php-fpm
pm.min_spare_servers = 5 定義空閒時段,子進程的最少數量,若是未達到,php-fpm會派生新的子進程;
pm.max_spare_servers = 35 定義空閒時段,子進程的最大值,若是高於這個值就開始清理空閒的子進程;
pm.max_requests = 500 每一個子進程最多處理的請求數,也就是一個php-fpm的子進程最多處理這麼多請求,當達到這個數值後,它就自動退出;
rlimit_files = 1024
request_slowlog_timeout = 1
slowlog = /usr/local/php-fpm/var/log/www-slow.log
php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
註釋:dynamic和static 表示以什麼形式啓動(動態或靜態);
pm = dynamic 就是動態,動態就是一開始爲一個數值,而後根據須要再自動生成,服務器比較閒的時候還會去銷燬,銷燬到必定程度還會自動建立,會根據下面的設置來設定生效;
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
request_slowlog_timeout = 1
slowlog = /usr/local/php-fpm/var/log/www-slow.log
php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
而若當設置爲 pm = static 後,則只有 pm.max_children = 50 這一個選項是生效的,其餘都未生效;
pm.max_children = 50
pm.max_requests = 500 rlimit_files = 1024 request_slowlog_timeout = 1 slowlog = /usr/local/php-fpm/var/log/www-slow.log php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/