Do I need so many PHP-FMP servers ? (resources saving)

Debian10 and MariaDB
When I installed Virtualmin on a VPS it came with PHP7.3 and I kept the default PHP-CGI

I needed PHP7.2 so I installed, then added PHP7.4 (following my application upgrade) and finally I switched for PHP-FPM to improve performance (and it did).

After upgrading Virtualmin (a few weeks ago) I see in the servers status:

  • PHP-FMP 7.2.x
  • PHP-FMP 7.3.x
  • PHP-FMP 7.4.x
  • PHP-FMP 8.x

And quite a lot of the following entries in Running Processes:
theonlyusergroup 250.16 MiB php-fpm: pool 16055170098148
www-data 224.98 MiB php-fpm: pool www

Finally my question;
I need only PHP7.4 for my CMS.
Is it safe to stop the other servers ? (webmin or vistualmin will continue to work)
Can I make it “permanent” (so they don’t come back if the server is restarted ?

Thanks

If all your virtual servers are using only v7.4.x, then you can just remove the other ones but the running processes are not caused by multiple PHP-FPM versions but by your fpm configuration.

You can limit the number of processes running by tweaking the fpm configuration (e.g. the max_children setting).

There are quite a number of articles & guides online on tuning fpm if you are unsure about your configuration. This is one of the articles that I initially followed while configuring the settings when I first started using FPM myself: https://serverpilot.io/docs/how-to-change-the-php-fpm-max_children-setting

Thanks for your fast answer !
I’m not a real sysadmin so I prefer to go slow than break something I won’t be able to fix. :woozy_face:

I understand that I have to deal only with my CMS requirements (Virtualmin will find his own way to what he need). I can “remove” the others.

then you can just remove the other ones

What “remove” mean ?
I see:

  • Stop button on the server status (but I feel it is not permanent)
  • Webmin => Bootup and Shutdown => php7.2-fpm, php7.2-fpm.service, etc

Or you mean something more radical like erasing the packages from the server, something like:
apt-get remove php7.2*
apt-get purge php7.2*
apt-get autoremove ?

This is a bit scary, Is there a short road using Virtualmin panel ?


Thanks for the link, started to study this… :pray:

For all of my servers, I usually go with the “apt purge” approach but if you are unsure, you can just go with the Webmin > System > Bootup and Shutdown > Tick the phpXX-fpm you want to disable> Disable Now and On Boot approach as well.

Only difference is that the Bootup and Shutdown approach won’t delete any files and dependencies of the disabled fpm version and you can re-enable them at any time without having to reinstall the extension and it’s dependencies again.

Great, thank you for taking the time to explain! :pray:

Have a nice day,
Bernard

Do note that in order for your CMS to be able to send notifications, you still need Postfix (or sendmail, but that would uninstall Postfix entirely, possible breaking stuff).

I’ll go with the shutdown approach so I can reverse. :wink:

Thanks !

For any future readers with this problem:

  • Don’t install a bunch of PHP versions. Install the one(s) that you need to run your app(s). One PHP version is better than four PHP versions in almost every case. Never install a PHP version just because you can, thinking, “Just in case somebody needs it later.”
  • A PHP version installed from your OS standard repos is better than from a third-party repo in almost every case, but sometimes you absolutely need something newer and a third-party repo is the only way to get it.
  • Downgrading PHP to support an app should be a last resort, only after you look into whether the app can be fixed to work with the current PHP version your OS providers (it’s usually small changes to the app for minor PHP version changes). Downgrading PHP should almost never happen. You might think, “I’ll just downgrade PHP and that will solve my problem”, but now you’ve probably got even more problems.
  • Choose a distro/version that is suitable for your app. Preferably one that a lot of people are running that app or framework on. Newer is generally better, unless your app is slow-moving and doesn’t support newer PHP/MySQL/etc. versions.
1 Like

Thank you Joe for adding more insight.
I’m a Tiki CMS member and I will pass it to several people that started to use Virtualmin.

While I mostly agree with all your points (and that’s why I wanted to know if it was safe to remove/shutdown some) I installed just what I needed in time I needed it.
Tiki21 work with PHP7.2 and Tiki22 with PHP7.4 so I installed 2 versions (as I update the software) because I needed them. The others came from the basic install and upgrade. :wink:

hi, I was recently stumbled upon this as well - if you use php7+ yes if no, then no. Actually php 7+ will safe resources on your machine.