PHP execution modes – FPM versus FCGId versus CGI wrapper

This article describes the PHP execution modes present in a Virtualmin installation.

We’ve extracted some of the information from the help bubble provided by Virtualmin at the following menu:
Virtual Server Name => Server Configuration => PHP Options

The three modes present are:

FPM is the best because it fast and also conserves memory better than FCGId. Both run PHP scripts quickly and as the domain owner.

Unless your system is heavily loaded or security between users is not an issue, CGI Wrapper could be an option.

mod_php is not recommended at all, and shouldn’t be on your system. It’s small gain in performance should be balanced against the lack of security between virtual servers.

As of Virtualmin version 7.x the control panel will offer an option to remove mod_php directives as it’s use has been discouraged for years.

Troubleshooting

How to check if you have lingering php-cgi processes

Sometimes after migration or incorrectly set up systems, you might encounter that some sites are still running php-cgi instead of FPM. To find out which sites are running php-cgi, use this command:

> ps -ef | grep php-cgi
example1+ 3158626 3123276 0 00:33 ? 00:00:07 /bin/php-cgi7.4
example1+ 3158652 3123276 0 00:33 ? 00:00:07 /bin/php-cgi7.4
example2 3177409 3123276 0 00:41 ? 00:00:01 /bin/php-cgi7.4
example2 3183811 3123276 0 00:44 ? 00:00:02 /bin/php-cgi7.4

If you see any php-cgi processes, we recommend you change them manually to FPM, or get the professional version of Virtualmin where you can do this in bulk:

See also

https://forum.virtualmin.com/t/excessive-apache2-processes-spawned-on-stock-ubuntu-20-04-virtualmin-install-leading-to-memory-depletion-and-eventual-crashes/115770/2

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top