Unable to change PHP version

Ubuntu 20.04

Hi, I have both 7.4 and 8.0 installed (FPM) but when selecting 7.4 it’s actually still loading 8.0 based on phpinof(). Apache and both FPM versions are restarted.

Both versions are correctly available with Re-Check Configuration:

Also both versions are available when choosing the PHP version for virtual server:

Virtual server PHP-FPM Configuration also uses conf file for 7.4:

So is there any workaround to get both PHP versions working with FPM?

Looks like there is another thread on the same issue and they fixed it by removing PHP 8.0. I would like to keep both 7.4 and 8.0 though.

Just a quick update: same thing happens on another Ubuntu 20.04 server as well with PHP 7.0 and 7.4 both installed. The higher version will be always used even when lower is selected.

Checking the apache config files, there’s both php7.4-fpm.conf and php8.0-fpm.conf. Seems like the SetHandler of higher PHP version overrides other versions.

EDIT: Solved it. These fpm config files for apache actually messed up everything and all php scripts were run as mod_php. Removed these two config files and everything works now as expected.

1 Like

Hi hiky,

would you mind elaborating what precisely you did to fix the “mess” created by the installed PHP 8.0 on an ubuntu 20.04 server.

I managed to uninstall PHP 8.0, set PHP 7.4 as default and have the virtual server use FPM, but am still not able to update my wordpress site due to permission errors, as if mod_php was activated.

I am no expert, so I’d be extremly thankful for any hint.

Thanks a lot in advance.

Hi @schraepler,

yes I had issues with the permissions as well, because mod_php runs as www-data instead of server owner.

I got both PHP 7.4 and 8.0 working on FPM simultaneously and permissions fixed:

  • removed both /etc/apache2/conf-enabled/php7.4-fpm.conf and /etc/apache2/conf-enabled/php8.0-fpm.conf
  • restarted apache
  • fixed permissions: Virtualmin → Limits and Validation → Validate Virtual Servers → Fix Permissions

Everything works now as expected and Wordpress has no permission issues anymore. The problem was the apache configuration files that were installed with PHP packages.

1 Like

@hikiy thank you so much for the explanations. Your help is much appreciated.

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