PHP7.0 messed up PHP5: Website in FCGId PHP5 mode always uses general /etc/php/7.0/fpm config.

This is the third time I make a support post on this forum for this issue, and I hope someone finally replies at least once.

After running an update on my Debian server which also installed PHP7.0, Virtualmin properly detected the new version and offers me the options of PHP5.3, PHP5.6.30 and PHP7.0 in the “PHP Versions” screen.

However, that’s where the issue starts:

  1. Server Configuration > PHP Versions > My website is configured to use PHP5.6.30.
  2. Server Configuration > Website Options > “FCGId” is selected.

Run phpinfo() on the website: PHP Version 7.0.22-3
Configuration file used: /etc/php/7.0/fpm/php.ini

Everything belonging to the domain is completely ignored: since it loaded a generic config file, it’s also not running as the virtual server’s owner, so the PHP scripts don’t have permissions to touch the files. I believe this to be the same for all domains on this Virtualmin.

I even tried once to remove AddHandler, FCGIWrapper, … relating to PHP7 from the domain’s Apache config, but it still ended up loading PHP7 rather than PHP5.

This is important and I’ve tried to find where the problem lies, but without internal knowledge of how Virtualmin loads its configuration files, loading priorities, symlinks to configuration files, … it’s almost a wild goose chase.

The domain includes a Wordpress installation that can’t be updated using their updater because of the file permissions. Obviously this poses a security risk and I’d really, really like to get it resolved.

Any help is greatly appreciated.

What’s your distribution and version? (That determines where PHP stuff comes from and where it is configured.)

“Everything belonging to the domain is completely ignored: since it loaded a generic config file, it’s also not running as the virtual server’s owner, so the PHP scripts don’t have permissions to touch the files.”

That’s weird. If it’s running under php-fpm it should always be as the domain owner. Only mod_php runs as Apache in any default configuration.

Try switching execution mode from fcgid to some other mode and then back again It sounds like some things have gotten botched and it’s not using the per-domain configuration.

I’ve already tried switching the execution mode from fcgid to both mod_php and CGI wrapper, and back, but unfortunately that didn’t fix it.

Operating system Debian Linux 10.0

To make sure I’m correct about not running as server owner (rather than relying on Wordpress telling me it doesn’t have access to the files), I went ahead and ran a custom PHP script to tell me the user it’s running as. It’s indeed running as the server owner but for some reason Wordpress seems to think it doesn’t have the proper permissions (and asks for an FTP login).

Some details related to the Wordpress issue, perhaps you have an idea:

Running PHP on Apache2, PHP script running as the user “X” (censored because it contains real names - tested via PHP’s get_current_user()), the upgrade tries to write a test file to check file permissions “/home/X/domains/subdomain.X.com/public_html/temp-write-test-1506593451” and it fails.

Did some debugging: according to PHP the directory is readable, permissions 0750, but it’s not writable.

Logged in on a terminal with that very same user, I can create/edit/delete any file anywhere in the directory, including the exact same path that PHP tried to write to. It all works.

I also did a chown -R X:X ., everything in the directory belongs to the user X.

drwxr-x--- 6 X X 4096 Sep 28 12:11 .

Yet PHP can’t write to the file.

Bump. Problem still exists.

So, you’ve said you’re running Debian 10.0 up there, but there is no Debian 10…so, what version are you running? I’m gonna try to reproduce this, but I’m pretty sure it’s specific to some set of circumstances (as we haven’t gotten any other reports and a lot of Virtualmin users use WordPress, including us).

So, I’ve tried reproducing it on Debian 8 (which is the only debian that has both 5 and 7 right after install, and so I’m guessing that’s what you’re working with)…and I can’t. WordPress is able to do everything it’s supposed to do, including update config files and install/update modules and such.

Also maybe important, did you install ( added) the 5.6.30 version after full installation of virtualmin, also the user it is running on as you write is only working well if configurations options are choosel well and ruuning ok. ( SO PHP -FPM for example has some other user settings / rights for the php part as Joe writes already )

It doesn’t look like php-fpm is nor really running / choosen in setup for that domain-user…
Is it an updated 5… virtualmin or fresh install VM 6 version

@Joe: There is a Debian 10, it’s Debian Buster, testing environment, although I have the same problem on a Debian 9 (= Debian stable). Both have run since Debian Jessie and have been upgraded along the way.

@Jfro: PHP 5.6.30 was installed before PHP 7.