php fpm – php-fpm: why i have a pool size higher than memory_limit

I know that there are many related topics, but I have not found my answer.

I have a dedicated server with 32Go of RAM (but I want PHP-fpm to use only 12Go max), and I have a PHP Fpm (7.2.13) that runs alongside an Apache server.

My problem is that every PHP FPM process consumes too much memory …
I measured it

ps -ylC php-fpm --sort: rss

The output included 269 processes, each with 121 MB in the RSS column, and a total of RAM on the dedicated 3Go server.

I've also created some PHP profiles with the PHP function "memory_get_peak_usage ()" and each of my scripts uses an average of 4Mo (peak load!) And a maximum peak load of 50Mo (this is a very special case though).
After profiling, I tried to set "memory_limit" to 10Mo, the special case did not work, so I set it to 50Mo and everything was fine (normal behavior).

My two questions are:

  • Since my PHP scripts do not exceed a peak usage of 50Mo and I set a memory limit of 50Mo, why is ANY of my PHP FPM processes 121M?

  • How is it possible to run 269 processes with 121 million each? The total amount of memory would be 269 * 121 = 32Go (and when I did this profiling, only 3Go RAM was used for the dedicated server altogether …)

Thank you for your help !

php fpm – how many children and servers are set to PHP-FPM

I see a big problem today, too much traffic got my website totally run down, but I have a big server to host it. I have the following:

BlockQuote
[20-May-2019 14:23:02] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and spawn 8 children, 4 of them idle and 22 children in total
[20-May-2019 14:23:03] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and spawn 16 children, of which there are 3 idle and 30 children in total
[20-May-2019 14:23:04] WARNING: [pool www] seems to be busy (possibly you need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 42 children in total
[20-May-2019 14:23:05] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 57 children in total
[20-May-2019 14:23:06] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 72 children in total
[20-May-2019 14:23:07] WARNING: [pool www] seems to be busy (you might need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 87 are children in total
[20-May-2019 14:23:08] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 102 children in total
[20-May-2019 14:23:09] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, of which 0 are idle and 117 children in total
[20-May-2019 14:23:10] WARNING: [pool www] seems to be busy (you may need to increase pm.start_servers or pm.min / max_spare_servers) and bring up 32 children, 9 of them idle and 132 children in total

But before I think I've configured enough kids in my fpm with this configuration:

  • pm.max_children = 100
  • pm.start_servers = 15
  • pm.min_spare_servers = 15
  • pm.max_spare_servers = 25

But I got this mistake. Do you know how many I can set up to accept more traffic? I have 32go RAM and 8 cores

Does CVE-2019-0211 affect Apache with php-fpm?

Intro

From version 2.4.17 (October 9, 2015) to version 2.4.38 (April 1, 2019),
Apache HTTP suffers from a local extension of root privileges
Out-of-bounds Array Access Vulnerability
any function call. The vulnerability is raised on Apache
gracefully restarts (apache2ctl graceful). In standard Linux
For configurations, the Logrotate utility executes this command once a day
6:25 am to reset protocol handles.

Sometimes php-fpm stops, what's going on?

I have the idea that my PHP Fpm56 sometimes seems to stop on my Direct Admin VPS server. The memory seems to be normal as the times when the PHP Fpm stops are a bit more heavy. The websites that are used will be loaded until I restart the services for php-fpm56. Other php-fpm70 websites are simply online.

The traffic to my webserver does not seem to have increased. Does anyone have any idea why PHP-Fpm is terminated regularly? I can not find any indication as to whether a particular script is responsible for this.

Is it maybe an attack? Or something else?
Who has an idea where to look?

Help to understand INI files and PHP_FPM

With PHP-FPM you can have configuration options in many places

1. Global php.ini – /opt/cpanel/ea-phpXX/root/etc/php.ini

2. The php-fpm pool files may contain php.ini values. For example, in cPanel, the pool conf has php_admin_value[disable_functions] = x, y, z, etc., which you can override by using the .yaml files and recreating the pool conf

3. The .user.ini – Important: "Only INI settings with PHP_INI_PERDIR and PHP_INI_USER modes will be recognized in .user.ini-style INI files." – which means that you can not enter everything there – The list of available options can be found at http://php.net/manual/en/ini.list.php. Look in the changeable column and make sure PHP_INI_PERDIR and PHP_INI_USER are present

That's it!

mod_lsapi vs PHP-FPM

We operate a new dedicated server with CL7 + Cpanel.

We had some instability issues with PHP FPM + Engintron, so we think about … | Read the rest of http://www.webhostingtalk.com/showthread.php?t=1750871&goto=newpost

php fpm – nginx and php-fpm: "Primary script unknown" when reading the response header from the upstream

I want to hand over everyone api / * away to php-fpm. Specially too index.php how I use Symfony. This is the only route PHP should use. Everything else is loaded by / usr / share / nginx / html / public (HTML files and CSS only).

I tried, but an error appears:

FastCGI has sent in stderr: "Primary script unknown" while the response header is read from the upstream

My nginx configuration is below:

Server {
hear 80 default_server;
listen [::]: 80 default_server;
Server name impressive.local;
index index.html index.php;

location / api {
Alias ​​/ usr / share / nginx / html / api;
try_files $ uri /index.php?$args;

location ~  .php $ {
fastcgi_pass php: 9000;
fastcgi_split_path_info ^ (. + . php) (/.*) $;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $ realpath_root $ fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $ realpath_root;
}
}

root / usr / share / nginx / html / public;
}

I get the following error message:

php_1 | [13-Jan-2019 23:22:54] NOTE: fpm is running, pid 1
php_1 | [13-Jan-2019 23:22:54] NOTE: Ready for connections
php_1 | 172.25.0.3 - 13 / Jan / 2019: 23: 22: 57 +0000 "GET /api/index.php" 404
web_1 | 2019/01/13 23:22:57 [error] 10 # 10: * 1 FastCGI sent in stderr: "Primary script unknown" when reading the response header from the upstream,
Client: 172.25.0.1, server: impressive.local, request: "GET /api/index.php HTTP / 1.1", upstream: "fastcgi: //172.25.0.2: 9000", host: "127.0.0.1:8080"
web_1 | 172.25.0.1 - - [13/Jan/2019:23:22:57 +0000] "GET /api/index.php HTTP / 1.1 404 27" - "" Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, Like Gecko) Chrome / 71.0.3578.98 Safari / 537.36 "" "

I wentogle for hours and saw several other responses to Stack Exchange. I can not figure out what causes that. I use Docker. Below is mine docker-compose.yml

Version: & # 39; 3 & # 39;
Services:
Network:
Picture: nginx: alpine
Volume:
- ./web:/usr/share/nginx/html
- ./conf/impressive.template:/etc/nginx/conf.d/default.conf
ports:
- "8080: 80"
Left:
- php

php:
Image: php: 7.3.1-fpm-alpine
Volume:
- ./web:/usr/share/nginx/html
ports:
- "9000: 9000"

nginx css and js files are provided by php-fpm

i have installed nginx and php-fpm and i have problem with css and js-files are provided by php-fpm. This is strace for php fpm process

                open ("/ home / user / public_html / he-2018-cache-v27.js", O_WRONLY | O_CREAT | O_TRUNC, 0666) = 6
fstat (6, {st_mode = S_IFREG | 0644, st_size = 0, ...}) = 0
lseek (6, 0, SEEK_CUR) = 0
write (6, "! - function (a, b) {" object "" == typeof "..., 8192) = 8192
write (6, "var e, f = a ([]c.length b) g = f.len "..., 8192) = 8192
write (6, "function (b) {var c; do if (c = p? b.la" ..., 8192) = 8192
write (6, "pe? (this.context = this)[0]= a, that. "..., 8192) = 8192
write (6, "d)) return} (c || (delete g[h].data, "..., 8192) = 8192
write (6, "m (c, this). index (i)> = 0: m.find (c, t" ..., 8192) = 8192
write (6, "ltChecked = a.checked)} Function wb" ..., 8192) = 8192
write (6, ", h.left = d, f && (e.left = f)), void 0 =" ..., 8192) = 8192
write (6, "), h = 1, i = 20, if (g && g[3]! == f) {f = f || "..., 8192) = 8192
write (6, "> = 0: void 0}}, k.checkOn || (m.valHo" ..., 8192) = 8192
write (6, "Fields"[f]&& (c[a.responseFields[f"..., 8192) = 8192
write(6, "meout(b):f.onreadystatechange=Xc"..., 8192) = 8192
write(6, "("src",image_verification.image_"..., 8192) = 8192
write(6, "ull_screen.file=$("#resize_file""..., 8192) = 8192
write(6, "'s JavaScript requires jQuery");"..., 8192) = 8192
write(6, "#'+b.id+'"]& # 39;), this.transitioning "..., 8192) = 8192
write (6, "ar a = this; this. $ element.hide (), t" ..., 8192) = 8192
write (6, "ttom left right")}, c.prototype.h "..., 8192) = 8192
write (6, "d (). find (& # 39;[data-toggle="tab"]& # 39). "..., 8192) = 8192
write (6, "$ element.addClass (this.options.l" ..., 8192) = 8192
write (6, "return a? 0: this._clones.length / 2" ..., 8192) = 8192
write (6, "ngs.autoRefresh && this.watch ()}, t" ..., 8192) = 8192
write (6, "var b = c.fullscreenElement || c.moz" ..., 8192) = 8192
write (6, "pe.draw = function () {varb, c = this." ..., 8192) = 8192
write (6, "p: $ (" # left-panel  "). offset (). to" ..., 2970) = 2970
close (6) = 0

The nginx php config looks like this:

                # Pass PHP scripts to PHP-FPM
location ~ *  .php $ {
fastcgi_pass unix: /var/run/user.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $ fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME / home / user / public_html $ fastcgi_script_name;
include fastcgi_params;
}

any ideas ?

linux – php-fpm status displays the queue 0 when requests are delayed

I have a PHP Fpm server running on a traffic-heavy website. Often, a point is reached where the active processes correspond to the maximum number of processes. This is the maximum number the server allows.

In this case, it may take 5 to 10 seconds for the php fpm status page to load. It appears that the request is in the queue. However, the list queue value always displays 0.

Why would not this indicate the correct value?