Failed to save PHP options : Number of PHP sub-processes must be between 1 and 20

Operating system: Debian
OS version: - 10
PHP-FPM

Hi all,

I’m trying to adjust the setting in for PHP and execution mode. I’m getting errors.


I have 3 virtual servers and running 3 websites on my server. one of the virtual servers I have easily set execution mode to FPM and set sub-processes number to 100 without any problem.

However, when I try to adjust the same to other servers (websites) I get this error, and the whole server crashes, and PHP-FPM won’t start.

The only way to fix this is to change to execution mode to FCGId

Anyone can give me some support here and help me troubleshoot this issue.

Thank you

Stop setting it to 100. Set it between 1 and 20, like the message says.

Edit: 100 is too many.

2 Likes

So should I set 20 to all my sites?

Sure. We fixed a problem in this area in the recent past, which may have broken it in other ways, I don’t know. (We were setting an absurdly high limit, by default, which was wrong.)

The number of processes is generally supposed to be one per computational unit, I think (so one per CPU core or thread or virtual core in a VM). Doubling that would be overkill, but harmless, tripling or more is counter-productive and will cause other kinds of resource starvation (I don’t understand any of this, as I have no familiarity with how concurrency is implemented in PHP-FPM, but I know experimentally that reducing the number from an absurd number to a reasonable number makes it go faster and behave more reliably).

1 Like

Great. I’ve set all 3 websites to 20. even I’m having a hard time understanding these values. perhaps someone who is knowledgeable and using Virtualmin can give a little more explanation for better understanding.

Thank you again @Joe

20 is probably still higher than it needs to be, unless you have 20 CPU cores. But, we also probably shouldn’t limit it to just 20, since there are CPUs with more cores than that pretty widely available (AMD has 32 and 64 core Epyc CPUs). Though I think most Virtualmin users are not running that kind of hardware.

1 Like

Ohh! so I guess 20 is way too much for me since I have only 8cores on my VPS. I should set it from 20 to 8

I changed the value to 4 in two of my virtual server. however, when I try to change the value to my last server, PHP-FPM restart failed and everything crashed.

I had to switch my execution mode to FCGId in order to get my PHP-FPM started. I try to change the execution mode back to FPM and again crashed.

After switching and a few tries I was able to set my execution mode to FPM and set the value to 4.

But when i checked the /etc/php/7.3/fpm/pool.d/161076943015368.conf
everything looks different

[161076943014352]
user = mysite
group = mysite
listen = localhost:8001
pm = dynamic
pm.max_children = 9999
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
php_admin_value[upload_tmp_dir] = /home/mysite/tmp
php_admin_value[session.save_path] = /home/mysite/tmp

What errors appear in the journal when restarting the service?

I’m sorry I don’t understand what you mean by journal

The error in your post tells you how to look at recent entries in the journal (journalctl -xe), but you can also look at messages for specific units (journalctl -fu php7.3-fpm).

And, by “journal” I mean the systemd journal, which is basically a log. Not a Virtualmin thing, it’s how all systemd systems log systemd activity like starting and stopping services.

I managed to edit manually and i set the same values in all three conf.

[162428999324298]
user = xxxxxxx
group = xxxxxxxx
listen = localhost:8000
pm = dynamic
pm.max_children = 6
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 20

Restarted the PHP-FPM server without any issue. I don’t know if these settings are sufficient

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.