I just did a clean installation of Virtualmin, with Nginx. After restoring some servers, I don’t see any php-fcgi-example-com running. So none of my domains have PHP.
Also, where is the option to choose PHP version for NGINX? Right now PHP is broken. Please help!
What’s your distribution and version? Did you use any other command line flags (like
I’m using Debian 8 (minimal), without any command line flags.
Also, how do you choose which PHP version to use when using Virtualmin with Nginx? When I click on the Re-Check Configuration, it says:
The following PHP versions are available : 5.6.30 (/usr/bin/php5-cgi), 7.0.23 (/usr/bin/php-cgi7.0), 7.1.9 (/usr/bin/php7.1), 5.6 (mod_php)
Do you want ssh access to the VPS to see for yourself why PHP isn’t working?
Direct pre-incident and hourly support is available in the shop. We do the best we can to help everyone for free here in the forums, but we can’t provide systems management services for free.
I just did a test install on Debian 9 with nginx and --minimal flag, and PHP is working fine…so, it’s almost certainly something unique to your system or applications. Check the error.log (in /home/domainname/logs) for clues. Also make sure you have correct ownership (owned by the domain owner and group) and permissions (not 777).
Also, test with a plain old
phpinfo(); program, so you can be confident it’s not something wrong with your programs rather than the execution environment.
I’ve been running Virtualmin with Nginx fine for the past 4 years, I was just offering you access to a recent fresh install of Virtualmin to see yourself. I haven’t touched the ownership or permissions and should have absolutely nothing to do with it. phpinfo file doesn’t work (obviously because PHP isn’t working). Standard txt file or HTML works fine.
Like I said, this is a clean install of Virtualmin on Debian 8 (minimal). I ran /bin/sh /root/virtualmin-install.sh without any flags.
I migrated several sites from a previous version of Virtualmin, because it was on Debian 7, running on an OpenVZ VPS, with PHP 5.4, and could not dist upgrade. I am trying to migrate sites that were working fine, to a fresh install of Virtualmin with Debian 8 and newer version of PHP.
It seems the issue has started occurring with the new Virtualmin install scripts / PHP-FCGI. The recent Virtualmin install scripts have introduced several bugs that I’ve already found installing Virtualmin several times, but I’ll try reinstalling again.
Don’t reinstall. Look at the logs I suggested for clues about why it isn’t working. I can help you with the right information.
Hi Joe, I really appreciate you taking the time to resolve the issue.
I just reinstalled again anyways, and the problem is still there. Here is the error log:
2017/09/16 14:41:09 [crit] 8352#0: *1 connect() to unix:/var/php-nginx/15055474867671.sock/socket failed (2: No such file or directory) while connecting to upstream, client: xx.xx.xx.xx, server: example.com, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/15055474867671.sock/socket:", host: "example.com"
When I try to restart the /etc/init.d/php-fcgi-example-com, it responds:
Failed to restart php-fcgi-example-com.service: Unit php-fcgi-example-com.service failed to load: No such file or directory.
Standard text files will load, PHP will not. I believe the PHP-FCGI service isn’t running. Please advise.
Any advise? It seems PHP-FCGI is broken with new Virtualmin installation on Debian 8.
The new Virtualmin installation has a broken PHP-FCGI implementation, which is an urgent issue. Can you please take a look into it?
If it’s really urgent, you should probably re-install on Debian 9. I know it works there.
I’m running a test install on Debian 8 right now, but I don’t know how long it’ll be before I’m able to sort it out (it might be something simple, or it might be something that requires a new Virtualmin module release or something else complicated).
My VPS provider doesn’t have Debian 9 available. I’ll just have to wait until you have time to fix it.
OK, on my test debian 8 system, PHP-FPM execution mode works, but fcgid does not. So, switch to PHP-FPM in Server Configuration->Website Options, and you should be able to run PHP apps. You probably want PHP-FPM, anyway, as it’s got some advantages over fcgid.
I’ll look into why fcgid isn’t working on Debian 8 (and also why it seems to be defaulting to that, since everywhere else we’re defaulting to PHP-FPM, as that’s now the recommended execution mode). I also see a couple of cosmetic issues, when using nginx (though I don’t think I saw them on other systems, so it may just be getting confused because there’s so many different PHP versions on Debain 8…I’m beginning to think it was a bad idea to install all of the available versions, as it definitely confuses people and even seems to confuse Virtualmin).
I had freshly installed Debian 8 with Virtualmin and had similar problem! It seems like the installation script didn’t install php7.1-cgi and php7.1-fpm. Try installing them: apt-get install php7.1-cgi; apt-get install php7.1-fpm
Then try creating a new virtual server and see if it works. If it works, modify existing php-fcgi scripts in “/etc/init.d/php-fcgi-*”
You’ll find: “… /usr/bin/php-loop.pl\ /usr/bin/php7.1\ …”
Change it to “…/usr/bin/php-loop.pl\ /usr/bin/php-cgi7.1\ …”
Watch out that you might have many “php-loop” processes have started but not working.
I would “kill” all of them then start each php-fcgi script and see.
I hope it helps!
Jamie and I just figured this out while chatting about the problem. Great catch, wyoungca!!
So, the solution is to install php7.1-cgi (php7.1-fpm is optional). We seem to be defaulting to the latest available version (which is not what I thought we were doing…and might be bug-like).
Also, we’ve spotted a bug in version selection with nginx. Jamie will sort that one and a new Virtualmin version will go out soonish with a fix.
So…yeah, install php7.1-cgi to fix fcgid execution under Nginx. Or switch to PHP-FPM, which also works.
After innstalling php7.1-cgi, you’ll need to switch execution mode to PHP-FPM and back again in order to get the new configuration. (Virtualmin tries to use php with the -b option if the necessary php-cgi command isn’t install, which doesn’t exist under php7.1, which fails…but switching execution modes causes it to rewrite the configuration with the right thing.)
This particular problem only affects Debian 8 (maybe 7, but I don’t think I ever sorted out PHP7 on Debian 7, so probably not). A new virtualmin-lemp-stack/virtualmin-lemp-stack-minimal metapackage will roll out tonight that fixes this (though it’ll always require switching execution modes back and forth for all affected virtual servers, as the config file has to be rewritten to fully resolve it.
PHP versions won’t work until Jamie is able to get that fixed, but it looks like it’s selecting the latest available version (while I think PHP-FPM is selecting the system standard version…so I guess that provides version switching in a hacky way for the time being).
Thanks wyoungca and joe for the info and helping me out. I can confirm that has fixed the problem. Look forward to the PHP version selection from Jamie.