I have both various Ubuntu 20 and 22 and some have PHP 8.0 as the default Nextcloud PHP version used. Even if I switch to 8.1 and verify via php -v, NC still uses old version. Done a2enmod and a2dismod various time, and narrowed the issue down to missing module for Apache to use.
Question is, how do I create this module and then have NC use the new module PROPERLY?
php -v only shows which binary is linked to your cli-command /usr/bin/php. It usually doesn’t show what version a specific vhost of apache is using.
You see where php8.0 is used, there is the php8.0.load in the /etc/apache2/mods-enabled folder (and no other php version). So it is clear that it uses php 8.0.
If you want to enable a specific module, it must be present, so check the /etc/apache2/mods-available folder if a never php version is available. I’d disable the old one before enabling the new one. If the new version is within the mods-available you probably missed to install a package (some libapache-mod-php*). You can search for them apt-cache search libapache2-mod-php
On the long run, if you only use your server for Nextcloud and don’t need several php versions in parallel, I’d just keep the one I want to use in order to avoid any confusion.