PHP-FPM can't start more than two pools

Hi,

I have the strange problem that I can't start more than two php-fpm pools. I want to host multiple websites on my server and thought it would be a good idea to give every website/user it's own php-fpm pool (nginx, php-fpm).

My /usr/local/etc/php-fpm.conf simply includes alle *.pool files and every pool got its own listen port (9000,9001,9002,...).

Starting php-fpm works perfectly, pool-files get included and php-fpm.log (debug) also shows:
Code:
[13-Dec-2014 09:18:09.641808] DEBUG: pid 23693, fpm_children_make(), line 421: [pool talontr] child 23694 started
[13-Dec-2014 09:18:09.642977] DEBUG: pid 23693, fpm_children_make(), line 421: [pool talontr] child 23695 started
[13-Dec-2014 09:18:09.644128] DEBUG: pid 23693, fpm_children_make(), line 421: [pool trollreport] child 23696 started
[13-Dec-2014 09:18:09.648186] DEBUG: pid 23693, fpm_children_make(), line 421: [pool trollreport] child 23697 started
[13-Dec-2014 09:18:09.649804] DEBUG: pid 23693, fpm_children_make(), line 421: [pool zzz] child 23698 started
[13-Dec-2014 09:18:09.650866] DEBUG: pid 23693, fpm_children_make(), line 421: [pool zzz] child 23699 started
[13-Dec-2014 09:18:09.652521] DEBUG: pid 23693, fpm_children_make(), line 421: [pool huehnerhose] child 23700 started
[13-Dec-2014 09:18:09.654318] DEBUG: pid 23693, fpm_children_make(), line 421: [pool huehnerhose] child 23701 started

But netstat -a shows only two ports, the pools aren't reachable
Code:
tcp4       0      0 10.0.0.10.9002         *.*                    LISTEN
tcp4       0      0 10.0.0.10.9001         *.*                    LISTEN
Now I tried to deactivate one pool-file after another. Whatever pool files are active: if more than two are present only the ones with 9002 and 9001 are active. If only two pool-definitions are present whatever port is defined gets startetd correctly.

I really don't have any explanation or idea where to start debugging this, grateful for any advise

Edit:
php-fpm and nginx are running inside a jail. I am relatively new to FreeBSD and the concept of jails, so I don't know if there could be a hidden error source somwhere.
 
So why don't you use sockets?
php-fpm.conf
Code:
; Include vhosts
include=/usr/local/etc/php/*.conf
In each configuration file
Code:
[poolname]
; This file is included into every .confo
listen = /var/run/php-$pool.sock
Then in the per-vhost configuration in nginx
Code:
  # PHP
  location ~ \.php$ {
  fastcgi_pass unix:/var/run/php-poolname.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;

Regards
Markus
 
Fair point, this works. But it doesn't feel like a win ;)

Seriously: I can live with that, for now. But I am really interested why there was this strange behavior in the first place.

Thanks!
 
I am having the same problem on 10.1 and 10.0 with both php55 and php56. First 2 pools are only created, none of the others. Sockets are not a solution on our load balanced multi server setup. Glad to hear someone else had the problem.

It looks like php-5.4.35 from the ports does not have this problem...
 
big thanks to you MattH
Then this looks like an PHP bug? But why does it seem like we are the only one experience this error. Is a setup with multiple php-fpm pools so rare or is there some interaction with FreeBSD?
I think the php bugtracker will love your post ;) I'm really looking forward to get rid of these socket files
 
Why would you want to get rid of the socket files? My understanding is that sockets would be faster because you don't have the overhead of the TCP/IP protocol to care about.
 
Why would you want to get rid of the socket files? My understanding is that sockets would be faster because you don't have the overhead of the TCP/IP protocol to care about.

The problem with socket files is that they only work in the same jail/machine. Although there is some performance penalty, using TCP ports allows for complete separation of the PHP process from the webserver or every other PHP process. From just a management view, I can keep PHP and the many many many dependencies isolated and even run multiple PHP versions, multiple hosts/jails to scale, etc...

I will post a bug report to PHP and see what they say. I have a feeling it is specific to FreeBSD.
 
Back
Top