Virtualmin 6 install script and php-fpm

Hi - This relates to a note I put into the forum about support for multiple versions of php with php-fpm.

I did a fresh install yesterday of a CentOS 7.3 VPS with the install.sh script. This went reasonably well now, but I note that when finished there is no version of php-fpm installed for php5.4 -- just for php 7.0. SO --- when you put in a domain, php-fpm does not show up as an option - it only apparently checks for php-fpm on 5.4.

Our problem here is that for all intents and purposes we never use 5.4. We would like to be able to use php5.6 or 7.0 with php-fpm. So two requests here -

  1. Fix the install script so there's at least ONE useful version of php-fpm - This works fine for php 5.4 after manually installing the php-fpm package, which appears to be missing in the install.

  2. Fix things so that other versions of PHP are working. php-fpm DOES get installed for php 7.0 -- but you can't set it up in Virtualmin as far as I can see.

Status: 
Active

Comments

That's odd, Virtualmin should detect PHP FPM 7.0.

If you SSH in as root and run virtualmin check-config , what does it say about FPM support?

If you check with php7.0 installed and php-fpm started for 7.0 you get this

sh-4.2# virtualmin check-config
Your system has 1.80 GB of memory, which is at or above the Virtualmin recommended minimum of 256 MB.

BIND DNS server is installed, and the system is configured to use it.

Mail server Postfix is installed and configured.

Postfix is configured to support per-domain outgoing IP addresses.

Apache is installed.

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 7.0.10 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 5.4 (mod_php)

PHP-FPM support is available on this system.

Webalizer is installed.

Apache is configured to host SSL websites.

MySQL 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 OK.

Plugin Bootup actions is installed OK.

Plugin DAV Login is installed OK.

Plugin Protected web directories is installed OK.

Using network interface eth0 for virtual IPs.

IPv6 addresses are available, using interface eth0.

Default IPv4 address for virtual servers is 69.4.98.199.

Default IPv6 address for virtual servers is fe80::54:ff:fe81:f314.

Default IP address is set to 69.4.98.199, which matches the detected external address.

Both user and group quotas are enabled for home and email directories.

All commands needed to create and restore backups are installed.

The selected package management and update systems are installed OK.

Chroot jails are available on this system

OK

BUT -- If you then go into Virtualmin and try to actually USE php-fpm for a domain it fails, because it apparently is trying to start the php-fpm service and you cannot run both php-fpm services at the same time -- so you get

Restarting PHP-FPM server ..
.. failed : Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.

And then virtualmin gets pretty confused from there on in.

You cannot run both versions of php-fpm simultaneously because they're both trying to run on the same port, so when you start the second one it fails.

I think the real problem here PROBABLY is just that VIrtualmin is trying to start the php-fpm service -which is 5.4 - and ignores the fact that the 7.0 service is running. I can live at least for now with only being able to use one PHP version with php-fpm on a single server (though of course that's not ideal). I would love to be able to use php-fpm at least on the dedicated VPS systems we sell people. But nobody wants to use php5.4 -- they either want 5.6 or 7.x --

As far as I can tell it can only use php-fpm for the 5.4 version of php --- which was also the case in the current Virtualmin version. But it may be as simple as just seeing if there is any sort of php-fpm running, and not trying to start the php5.4 version.

You're right - Virtualmin will try to start/restart the php-fpm service instead of php7-fpm if the former exists.

Why not simply uninstall the old version 5.4 package? That should make Virtualmin detect only the 7.0 version.

virtualmin doesn't ever seem to show that php-fpm is available unless php-fpm is installed. If you run virtualmin check-config it says that php-fpm is not available unless the 5.4 version is installed.

That's how I discovered that the default install doesn't include the php-fpm package for 5.4 --- Virtualmin just never made the php-fpm option available.

If you uninstall php-fpm, virtualmin just thinks that php-fpm is unavailable and won't let you turn it on for a domain. I think that the php-fpm package is just hard-wired in everywhere and nothing works unless it's installed. And if it IS installed virtualmin keeps trying to start up the php-fpm service, which isn't the one we need.

It could be that we're looking in the wrong place for the FPM 7.0 config files.

If you un-install version 5.4 and run virtualmin check-config , what exactly does it say about FPM support?

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 7.0.10 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 5.4 (mod_php)
PHP-FPM support was not detected : No FPM server bootup action found

Ok, now we are getting somewhere. What is the bootup action for FPM 7.0 called? You can see this by running systemctl | grep fpm

So -- it's like this. I REALLY like to run the REMI repository instead of the SCL repository, The SCL stuff is downstream from the Remi stuff, and the REMI repos are always more up-to-date and more comprehensive (for example the REMI repos contain php-pecl-memcache, and the SCL ones don't).
SO -- for the SCL repos which you install by default now, the service is

rh-php70-php-fpm.service For the REMI repos it's php70-php-fpm.service

And for php56, which I would also like to see supported, just substitute 56 for 70 in both of the above.

This is all sort of irritating in that the REMI repo seems more consistent about naming between releases, etc. than SCL has been.

Anyway, if you could support any PHP version of both of those repo classes, that would be fantastic. The code between the repos is pretty much identical for any particular version - it's just that the SCL stuff is a level later and sometimes seems to be missing packages. And I suspect you'll find that a lot of people prefer to use remi rather than the SCL/SCLO packages.

Thanks - the current code doesn't look for those init scripts, but we will fix this in the 6.01 release.

I'm glad to hear that - that may help us out with some performance issues with a few of our customers. No huge hurry with that, but it will be nice to have. I want to say that Virtualmin is the best. Dealing with you guys is almost always spectacularly fast and professional, unlike what I see with 90% of the companies out there. If only it was easier to deal with the clients who only only only want Cpanel because thats a "real" control panel. I've always appreciated that VIrtualmin mucks around with the OS as little as possible, unlike some of the other systems where it's "sort of linux, but a whole lot control panel" when you're done. I only wish we were a big enough company to throw more cash your way (though I'm working on that).

Joe's picture
Submitted by Joe on Fri, 08/11/2017 - 15:54 Pro Licensee

I've also added dependencies to the yum groups. So, php-fpm will get installed for the CentOS standard PHP packages, too. But, we definitely want the PHP7 packages to work easily.

Thanks for the heads up.

DID this fix, then recheck sees php-fpm https://github.com/virtualmin/virtualmin-gpl/commit/33af00338be9a48cf441... Site configuration you can check for php-fpm but ending with message ""Failed to save website options : No PHP versions found for mode fpm""

Remi php 5.6.31 php-fpm is running and re-check gives:: "" The following PHP versions are available : 5.6.31 (/bin/php56-cgi), 7.0.10 (/opt/rh/rh-php70/root/usr/bin/php-cgi)

PHP-FPM support is available on this system. """

(before with this php on the base location it was working, i removed these version and replaced with same but then location php56 and ofcourse virtualmin 6.0 didn't reconized is, apllied the fix then it was there but adding the setting to site configuration it ended with the error message.)

apache 2.4.27 , other php-fpm versions failed to load while tcp socket port 9000 is already in use. ( but the running version 5.631 is choosen in virtualmin panel by site configuration)