Changing an existing server from PHP CGID to PHP FPM

Hi, I am trying to change an existing virtual server to PHP FPM from CGID via “Server Configuration -> Website Options” and it seems to have changed successfully. However I wasn’t able to change the server to PHP version 7.4, like I was using on CGID. Is there a way to change it? I only have one virtual server on my install. I read somewhere that I have to change the Default PHP version on the server, but I am unsure how to do that.

Also, I have a Wordpress installation the server and when trying to access the website, I got an error stating: “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

Any assistance is greatly appreciated!

1 Like

Hi,
You don’t tell us what linux your on but for Ubuntu This will install almost everything you need

sudo apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-soap php7.4-zip php7.4-bcmath -y

It might be worth running Virtualmin > System > Re-check configuration to generate any new php.ini files

Hi,

You would need to make sure that:

  1. php7.4-fpm package is installed
  2. That you patched your current version of Virtualmin to be aware of PHP 7.4 (it’s currently not)
  3. Re-check configuration from UI or run virtualmin check-config from console
1 Like

Thanks! I didn’t realize I had to patch Virtualmin to be aware of PHP 7.4.

Hi, I tried those steps, however I still get the same PHP MySQL error from Wordpress.

I got this error when trying to select PHP 7.4 in website options: " Failed to save PHP versions : The PHP version cannot be changed when in FPM mode"
Also, @Alecbarnes I am on Ubuntu 18.04, sorry I forgot to mention that.

You need to make sure that you are running the latest Virtualmin 6.08.

Hi, thanks for the reply!

Yes, I am running Virtualmin 6.08

You don’t choose PHP version on Website Options page. Can you provide a screenshot of what you’re doing and what is failing?

Have you applied the patch and restarted Webmin? Have you installed php7.4-fpm package and re-run configuration check?

Hi, this is what I did:

  1. Installed php7.4-fpm
  2. Applied patch to /usr/share/webmin/virtual-server/virtual-server-lib.pl
  3. Restarted Server
  4. Re-ran configuration checker
  5. Changed PHP mode to FPM in Server Configuration > Website Options
  6. Attempted to change PHP version to 7.4 in Server Configuration > PHP Versions and version 7.4 Does show up in the drop down box, however when I click Save Versions I get the error Failed to save PHP versions : The PHP version cannot be changed when in FPM mode

The moment I installed PHP-7.4 packages, it showed immediately on the list:

What is the output of:

php -v
whereis php

Just to mention, this is how I installed PHP on my Ubuntu 18.04:

```
apt-get update
apt -y install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.4-fpm
```

This is the output of php -v:

PHP 7.4.1 (cli) (built: Dec 18 2019 14:44:22) ( NTS )
Copyright © The PHP Group
Zend Engine v3.4.0, Copyright © Zend Technologies
with Zend OPcache v7.4.1, Copyright ©, by Zend Technologies

And this is the output of whereis php:
php: /usr/bin/php7.3 /usr/bin/php /usr/bin/php7.2 /usr/bin/php7.4 /usr/lib/php /etc/php /usr/include/php /usr/share/php7.3-xml /usr/share/php7.3-mbstring /usr/share/php7.4-mysql /usr/share/php7.2-gd /usr/share/php7.3-mysql /usr/share/php7.2-mysql /usr/share/php7.3-common /usr/share/php7.3-soap /usr/share/php /usr/share/php7.3-zip /usr/share/php7.3-curl /usr/share/php7.3-gd /usr/share/php7.2-mbstring /usr/share/php7.2-common /usr/share/php7.2-xml /usr/share/php7.4-curl /usr/share/php7.4-gd /usr/share/php7.4-xml /usr/share/php7.4-opcache /usr/share/php7.3-intl /usr/share/php7.4-readline /usr/share/php7.4-json /usr/share/php7.2-opcache /usr/share/php7.4-common /usr/share/php7.3-readline /usr/share/php7.2-json /usr/share/php7.4-mbstring /usr/share/php7.2-readline /usr/share/php7.3-json /usr/share/php7.2-curl /usr/share/php7.3-opcache /usr/share/man/man1/php.1.gz

Here are some screenshots:
I get this error when selecting PHP 7.4 (and even PHP 7.3) and saving the settings:

It looks like it’s not supported in Nginx Webserver module, as by looking at the code it’s intended to work only in FCGId mode.

@Jamie Is this a limitation of Nginx Webserver itself, meaning that PHP version can not be changed in FPM mode on Nginx, right?

Correct, multiple FPM versions aren’t supported under Nginx yet.

Thank you.

Is there a way to switch to FPM using only one PHP version? I can’t seem to select the version.

I ended up removing the older php versions using apt-get purge and I was then able to switch to the proper php fpm version.

However, after I restarted the server, I started getting a 502 error (I am going through Cloudflare).

I did some research and saw that I might have to change the fastcgi_pass in my domains nginx.conf file to something. Not sure if this is the issue, but I’d appreciate any help in getting this up and running. I didn’t notice anything in the nginx logs.

Thanks!