Phpmyadmin showing php code instead of website

I am using Ubuntu 22.04.4 LTS and PHP 8.2.16 (cli). I successfully installed phpmyadmin after setting up apache2 & even gave the conf file path. But PHP is not working properly and So far my apache2, php, and mysql are working fine except phpmyadmin… Whenever I run this:

https://www.<domain-name>.com/phpmyadmin/

I am left with this on my browser:

<?php

declare(strict_types=1);

use PhpMyAdminRouting;

if (! defined('ROOT_PATH')) {
    // phpcs:disable PSR1.Files.SideEffects
    define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
    // phpcs:enable
}

global $route, $containerBuilder;

require_once ROOT_PATH . 'libraries/common.inc.php';

$dispatcher = Routing::getDispatcher();
Routing::callControllerForRoute($route, $dispatcher, $containerBuilder);

I searched about this issue & the most common answer was to install libapache2-mod-php8.1 that’s what I tried to do but I encountered the following:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache2-mod-php8.1 : Depends: php8.1-common (= 8.1.2-1ubuntu2.14) but 8.1.27-2+clp-jammy is to be installed
E: Unable to correct problems, you have held broken packages.

As I am using php8.2 in my system I also tried to install libapache2-mod-php8.2 but got the following error:

E: Package 'libapache2-mod-php8.2' has no installation candidate

I also tried re-installing phpmyadmin but nothing worked.

Also when I tried to remove all PHP & reinstall only the necessary ones with the following command:

apt-get --purge remove php-common

or

sudo apt install php8.1-common=8.1.2-1ubuntu2.14

I get the following error. (I am using SSH & have a VPS Hosting along with CloudPanel)

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
php8.1 is already the newest version (8.1.27-2+clp-jammy).
php8.1-common is already the newest version (8.1.27-2+clp-jammy).
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
root@srv480865:~# sudo apt install php8.1-common=8.1.2-1ubuntu2.14
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apt-show-versions dbconfig-common dbconfig-mysql fail2ban fonts-droid-fallback fonts-noto-mono ghostscript gifsicle gsfonts
  icc-profiles-free imagemagick-6-common iotop javascript-common jpegoptim libaom3 libapt-pkg-perl libarchive-tools
  libavahi-client3 libavahi-common-data libavahi-common3 libc-client2007e libcups2 libdav1d5 libde265-0 libevent-2.1-7
  libfftw3-double3 libgs9 libgs9-common libheif1 libidn12 libijs-0.35 libjbig2dec0 libjemalloc2 libjs-bootstrap4 libjs-codemirror
  libjs-jquery libjs-jquery-mousewheel libjs-jquery-timepicker libjs-jquery-ui libjs-popper.js libjs-sizzle libjs-sphinxdoc
  libjs-underscore liblcms2-2 liblqr-1-0 libltdl7 liblua5.1-0 liblzf1 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmcrypt4
  libonig5 libopenjp2-7 libossp-uuid16 libpaper-utils libpaper1 libsensors-config libsensors5 libwebpdemux2 libwebpmux3 libx265-199
  libxmlrpc-epi0 libzip4 lua-bitop lua-cjson memcached mlock nginx node-jquery optipng php-google-recaptcha php-mariadb-mysql-kbs
  php-nikic-fast-route php-phpmyadmin-motranslator php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-phpseclib php-psr-cache
  php-psr-container php-psr-log php-symfony-cache php-symfony-cache-contracts php-symfony-config php-symfony-dependency-injection
  php-symfony-deprecation-contracts php-symfony-expression-language php-symfony-filesystem php-symfony-polyfill-php80
  php-symfony-polyfill-php81 php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig php-twig-i18n-extension
  php7.1 php7.1-bcmath php7.1-cli php7.1-common php7.1-curl php7.1-fpm php7.1-gd php7.1-imap php7.1-intl php7.1-json
  php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-readline php7.1-soap php7.1-sqlite3 php7.1-xml php7.1-xmlrpc
  php7.1-xsl php7.1-zip php7.2 php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-imap php7.2-intl
  php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-soap php7.2-sqlite3 php7.2-xml php7.2-xmlrpc
  php7.2-xsl php7.2-zip php7.3 php7.3-bcmath php7.3-cli php7.3-common php7.3-curl php7.3-fpm php7.3-gd php7.3-imap php7.3-intl
  php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline php7.3-soap php7.3-sqlite3 php7.3-xml php7.3-xmlrpc
  php7.3-xsl php7.3-zip php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-imap php7.4-intl
  php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-sqlite3 php7.4-xml php7.4-xmlrpc
  php7.4-xsl php7.4-zip php8.0 php8.0-bcmath php8.0-cli php8.0-common php8.0-curl php8.0-fpm php8.0-gd php8.0-imap php8.0-intl
  php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline php8.0-soap php8.0-sqlite3 php8.0-xml php8.0-xsl php8.0-zip php8.2
  php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-imap php8.2-intl php8.2-mbstring php8.2-mysql
  php8.2-opcache php8.2-readline php8.2-soap php8.2-sqlite3 php8.2-xml php8.2-xsl php8.2-zip php8.3 php8.3-bcmath php8.3-cli
  php8.3-common php8.3-curl php8.3-fpm php8.3-gd php8.3-imap php8.3-intl php8.3-mbstring php8.3-mysql php8.3-opcache
  php8.3-readline php8.3-soap php8.3-sqlite3 php8.3-xml php8.3-xsl php8.3-zip poppler-data pwgen python3-pyinotify rclone
  redis-server redis-tools sqlite3 sysstat unzip uuid varnish whois zip
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  cloudpanel php-curl php-gd php-json php-mbstring php-mysql php-zip php8.1 php8.1-bcmath php8.1-cli php8.1-curl php8.1-fpm
  php8.1-gd php8.1-imap php8.1-intl php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-soap php8.1-sqlite3
  php8.1-xml php8.1-xsl php8.1-zip phpmyadmin
The following packages will be DOWNGRADED:
  php8.1-common
0 upgraded, 0 newly installed, 1 downgraded, 25 to remove and 9 not upgraded.
Need to get 0 B/1,127 kB of archives.
After this operation, 357 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 158292 files and directories currently installed.)
Removing cloudpanel (2.4.1-1+clp-jammy) ...
This account is currently not available.
dpkg: error processing package cloudpanel (--remove):
 installed cloudpanel package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 cloudpanel
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

My php8.1 & php8.1-common is already updated:

php8.1 is already the newest version (8.1.27-2+clp-jammy).
php8.1-common is already the newest version (8.1.27-2+clp-jammy).

I have added ppa:ondrej/php, but these are the list of repositories:

deb http://in.archive.ubuntu.com/ubuntu/ jammy main restricted
deb http://in.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb http://in.archive.ubuntu.com/ubuntu/ jammy universe
deb http://in.archive.ubuntu.com/ubuntu/ jammy-updates universe
deb http://in.archive.ubuntu.com/ubuntu/ jammy multiverse
deb http://in.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
deb http://in.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://in.archive.ubuntu.com/ubuntu/ jammy-security main restricted
deb http://in.archive.ubuntu.com/ubuntu/ jammy-security universe
deb http://in.archive.ubuntu.com/ubuntu/ jammy-security multiverse
deb https://ppa.launchpadcontent.net/ondrej/apache2/ubuntu/ jammy main
deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/ jammy main
deb [arch=amd64] https://repository.monarx.com/repository/ubuntu-jammy/ jammy main

Honestly, I am an Ubuntu noob & can’t figure out how to fix it. How do I resolve it?