Virtualmin supports multiple PHP versions per virtual server. On AlmaLinux/Rocky Linux/CentOS/Oracle Linux/Fedora Linux, you can enable Remi's Repo and install PHP from there.
. /etc/os-release && dnf -y install https://rpms.remirepo.net/enterprise/remi-release-$(rpm -E %$ID).rpm && dnf clean all
Install additional PHP packages like normal.
dnf install php*-php-{cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,xml,zip}
For example, to install PHP 8.2, run the command as:
dnf install php82-php-{cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,xml,zip}
In Virtualmin, go to your virtual server > Server Configuration > PHP Options and then select the PHP version.