Using dnf module php leads to wrong php-fpm configuration directory being used

SYSTEM INFORMATION
OS type and version AlmaLinux 9.4
Webmin version 2.111
Virtualmin version 7.10.0
Related packages php74

Using Apache with php-fpm 7.4 and 8.1. Originally I had the default system version of php installed, which was 8.0, and I had php74 and php81 installed separately. So php --version would return 8.0. All 3 had fpm installed as well. I am new to AlmaLinux 9 and dnf, so when I found out you can have the default php changed to 7.4 via dnf module enable php:remi-7.4, I did that. I uninstalled php74 entirely and reinstalled it as the stream version, so now my php command is not 8.0, but 7.4. I had ton of scripts that needed 5.6, but 7.4 did okay with deprecated errors disabled, and I did not want to have to change all of them to run explicitly php74 instead of php.

So here is the problem. The new php-fpm (7.4 stream) uses /etc/php-fpm.conf and /etc/php-fpm.d/*. However, Webmin and Virtualmin keep saving the php-fpm conf files for 7.4 into /etc/opt/remi/php74/php-fpm.d/ folder instead. I found out I can include it in the php-fpm.conf, which resolves the issue, but I have to ask if this is a feature or a bug. Feature because it’s still php74 from Remi repository, so Virtualmin assumes a different directory? Or bug, because it’s not detecting the use of the stream?

I tried restarting Webmin, Virtualmin, uninstalling both php-fpms, nothing works. The directory sticks to that old php74 one, and not /etc/php-fpm.d/ one. Grepping the Virtualmin server php-fpm conf file names (string of numbers) made it even more confusing, as /etc/webmin/phpini has the correct directory listed for them all. I have no idea where it’s picking up the wrong directory, so what else can I do about it other than the quickfix I did?

A few things.

You absolutely should not have two of the same version of PHP installed from different sources.

When you make dramatic changes, you need to use Re-Check Configuration so Virtualmin knows about them.

It’s also possible we don’t detect this PHP version/package correctly. We so many different packages and config locations, etc. there are a lot of variables. But, I don’t see you saying you did Re-Check configuration, so start there.

Oh my bad, I failed to mention that, thought I did. I did it every time I did any changes, that’s why I am so bewildered. Tried it via CLI and GUI both. It did help a little bit, as it would switch all the servers over to another version, when 1 was removed. Having not found say 7.4, it would switch to 8.1 and back again, when I would install 7.4 back and uninstall 8.1. Only reason I did that was trying to get Virtualmin to pick up the php-conf.d directory correctly, but nothing makes it stick.

Where exactly is the actual folder location for this php-fpm version stored in the files? I could not find that, only the new and correct stream directory was listed, but never actually used when saving php-fpm options for a server via GUI.

Also, when going to PHP-FPM Configuration, it lists the .conf file in the remi folder, so at least it’s consistent there.

Screenshot - 2024_05_10 , 17_20_09

You need to switch to another PHP version and then “back” (but this is not going back, this is a different package and thus a different version), most likely to regenerate the configs with new paths.

I sort of tried that too, not switching streams, but I reset the module, uninstalled everything, switched module back to 7.4, reinstalled php-cli etc. The issue just won’t go away. I am thinking it’s just a unique situation on my part and I need to manually edit the php-fpm.d folder somewhere, but I have no idea where. It can’t be baked into the php rpms, since the php-fpm.conf file specifically includes the /etc/php-fpm.d/* directory, which it reads fine, and I fixed the issue by adding the old Remi php74 one as an additional include= line. But why is Virtualmin still picking up that old directory?

No, I mean switch the version in the Virtualmin domain.

Yeah I tried that several times as well, no go. It just goes back to the same folder in /etc/opt/.

Well, so I guess there is no way to fix this other than what I did in having php-fpm pick up the .conf files from the /etc/opt folder?

Run Re-Check Configuration and show us the output.

Here is the output, IPs edited for privacy:

The status of your system is being checked to ensure that all enabled features are available and properly configured …
Your system has 61.93 GiB of memory, which is at or above the Virtualmin recommended minimum of 256 MiB
BIND DNS server is installed
Mail server Postfix is installed and configured
Postfix is configured to support per-domain outgoing IP addresses
Apache is installed
Apache supports HTTP/2 on your system
The following CGI script execution modes are available : fcgiwrap
The following PHP execution modes are available : fpm fcgid cgi
The following PHP versions are available : 7.4.33 (/bin/php), 8.1.28 (/bin/php81-cgi)
The following PHP-FPM versions are available : 7.4.33 (php-fpm) 8.1.28 (php81-php-fpm)
Apache is configured to host SSL websites
MariaDB 10.5.22 is installed and running
ProFTPD is installed
Logrotate is installed
SpamAssassin and Procmail are installed and configured for use
ClamAV is installed and assumed to be running
Plugin AWStats reporting is installed
Plugin Protected web directories is installed
Using network interface enp35s0 for virtual IPs
Default IPv4 address for virtual servers is 0.0.0.0
Detected external IPv4 address is 0.0.0.0
Quotas are not enabled on the filesystem / which contains home directories under /home/chroot and email files under /home/chroot. Quota editing has been disabled
All commands needed to create and restore backups are installed
The selected package management and update systems are installed
Chroot jails are available
… your system is ready for use by Virtualmin
Applying webserver configuration …
… done

Hmmm…OK, also post the output of this:

grep -R '/etc/opt/remi/php74' /etc/webmin/virtual-server

Did it. Nothing. Here is ls of the folder as well.

[root@server ~]# grep -R '/etc/opt/remi/php74' /etc/webmin/virtual-server
[root@server ~]# ls /etc/opt/remi/
php74  php80  php81
[root@server ~]# ls /etc/opt/remi/php74
php-fpm.d  php-fpm.d.bak  php.d  php.ini.bak  php.ini.rpmsave

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