PHP-FPM update with Nginx + Ubuntu 18.04

I’m running the latest Virtualmin (6.08) with Nginx on Ubunut 18.04. I’m trying to update php from 7.2 to 7.4, which I’ve successfully added.

“Re-Check Configuration” successfully sees the updated verion:
The following PHP versions are available : 7.2.33 (/usr/bin/php-cgi7.2), 7.4.9 (/usr/bin/php-cgi7.4)
The following PHP-FPM versions are available on this system : 7.2.3 (php7.2-fpm) 7.4.9 (php7.4-fpm)

Nginx only allows one version php-fpm, so I’m unable to update sites to php 7.4. I get the following error: Failed to save PHP versions : The PHP version cannot be changed when in FPM mode

I’ve tried switching from FPM to FCGid, restarting nginx and webmin, and then switching back to FPM to see if Virtualmin picks up the updated php7.4-fpm (as suggested in another thread). This hasn’t been successful though. I also tried doing the same manually in terminal unsucessfully.

I’m having trouble figuring out how to ignore php7.2-fpm and use php7.4-fpm so that I can update sites to use php 7.4. I’ve searched the forum and the only successful implementation I’ve seen is by completely removing the old, base version of php (in this case 7.2), which is not recommended.

Does anyone know a solution to this challenge?

Hello @camporella and welcome to the community. Please note that Virtualmin (6.08) is not the latest version, as you have stated; 6.11 is, FYI

Could you try this:
From FPM, switch to FCGid, (no need to restart servers) then change PHP version and then try to switch from FCGid to FPM.

@calport Thank you noticing I’m on an older version! For some reason Virtualmin repos were missing, which I’ve added back in and I’m now on the actual current 6.11 version.

I’ll try your suggestion this evening and report back. There’s quite a bit of live traffic at the moment and noticed when I make changes to PHP there’s a few seconds of downtime.

Thanks for the suggestion. I changed to FCGid and verified that php 7.4 was the active php version when in FCGid mode. In fact, when I made this change 7.4 was automatically enabled as the default, which I verified using the following script

echo 'Current PHP version: ' . phpversion();

However when I switched back to FPM, it reverted back to php 7.2.

I should note that I’m attempting this update on a sub-server, in case that is causing a conflict. I have tried on the primary server as well with the same result, but possibly all domains need to be updated at the same time?

Update: I came across this older discussion, which suggested removing php7.2-fpm. I did that and then did the switch to FCGid and back to FPM. All is working well now.

https://www.virtualmin.com/comment/794816#comment-794816

1 Like

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