Php mode differences.. which is best for me?

Operating system: Ubuntu
OS version: 16.4 & 20.4

I need to understand the differences between the different modes of running php under Virtualmin. I have googled a fair amount and think I understand some things, but some doesn’t make sense within a Virtualmin context. I have several web servers, each running multiple sites, and some of the sites on a given server require different versions of php. So “multi - php versions” is a baseline requirement.

I do understand that there are issues with Virtualmin running FPM that will hopefully be solved in Virtualmin 7. It seems this is the best thing, but I need to know what’s best in the mean time.

I am currently running “cgi wrapper” mode. It’s slow.

My understanding is that mod_php doesn’t really work in a multi-php environment. I ran into a problem with a 3rd party application that sets php ENV variables in .htaccess files, and came to learn running in su_exec mode (as cgi wrapper does) strips out ENV variables. So this was a failure. On a lark, I tried setting that ONE site to use mod_php, and it all SEEMS to work despite what I thought I knew. Could it be that mod_php DOES work, but only for one version of php? In other words, while you can set cgi wrapper to different versions of php, all sites that use mod_php must use the same version of php? Or is my understanding of mod_php’s limit for multi-php servers completely wrong?

I’ve heard good things about FCGId, but what information I find about it on the web is that it actually uses the fpm service instead of calling php-cgi directly for each call. That would be good, but does that run into the problem with FPM that will not be fixed until Virtualmin 7? I’ve seen other info where FCGId uses services other than FPM, and my Virtualmin config says I can use it, but to my knowledge I haven’t installed anything special on the server that would allow this. Is FCGId safe to use and effective for my needs until FPM works correctly?

Lastly, is there an ETA for when FPM will work effectively?

PHP-FPM is the only execution mode we recommend today. I don’t consider multi-PHP versions a requirement, or even a recommended feature to use. But, we understand some folks need it.

For now, the only way to get multiple versions of PHP in a reasonable production safe way is FCGId+suexec. There are no other reasonable options. CGI is not suitable for production (it can be useful for testing or for rarely used tiny apps), mod_php is not suitable for anything today.

In short: PHP-FPM unless you absolutely cannot make your apps work in one version of PHP. FCGId+suexec otherwise, but only until Virtualmin has support for multiple versions with PHP-FPM.

Edit: Any app that won’t run under suexec or PHP-FPM cannot be trusted on a public facing site.

1 Like

Thank you for the reply, and apologies for the delay, I’ve been out of the office since posting this.

Don’t get me started on the app that requires mod_php. It’s very old, minimally maintained, and unfortunately there’s nothing like it available. It’s an open source app maintained by a major university for science education users. For us to replicate it in house would take years, given the amount of time we could dedicate to it weekly. We are more likely to drop support (and make people mad) than recreate it.

Is there a rough ETA on when PHP-FPM will fully support multiple versions?

I wasn’t aware of this PHP-FPM multpile version issue. It’s likely that I don’t have full grasp of what is being discussed but on a server with multiple sites I have PHP-FPM 7.0.27 running on some sites and PHP-FPM 7.2.24 on others - without apparent issue.

I don’t have a grasp of it either but I know there is one. Maybe Joe can fill us in.

Jamie may have finished support for multiple versions in 6.15. I don’t know.

So, it’s not an “issue”. It’s just that there isn’t (maybe past tense wasn’t, if it’s been finished and I just didn’t notice) support for setting up multiple versions of PHP with PHP-FPM. But, if you were able to choose different versions with both using PHP-FPM, then I guess that support has been finished.

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