Nextcloud php file loads as printed text

Nextcloud version (eg, 20.0.5) : 20.0.1
Operating system and version (eg, Ubuntu 20.04) : Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25) : Apache 2.4.48
PHP version (eg, 7.4) : PHP 8.0.7

Hello, I’m running LAMP on ubuntu 20.04 which was recently updated. My Nextcloud installation was out of date on version 16 so I spent time going through the upgrade cycles to version 20.0.1
However, at version 20.0.1, I had some internal server error 500 so I reinstalled Apache, but I seem to have broken the nextcloud in the process.
My Nextcloud index.php prints only the content, ie

<?php
/**
 * @copyright Copyright (c) 2016, ownCloud, Inc.
 *
 * @author Christoph Wurst <christoph@winzerhof-wurst.at>
 * @author Joas Schilling <coding@schilljs.com>
 * @author Jörn Friedrich Dreyer <jfd@butonic.de>
 * @author Lukas Reschke <lukas@statuscode.ch>
 * @author Morris Jobke <hey@morrisjobke.de>
 * @author Robin Appelman <robin@icewind.nl>
 * @author Roeland Jago Douma <roeland@famdouma.nl>
 * @author Sergio Bertolín <sbertolin@solidgear.es>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
 * @author Vincent Petry <pvince81@owncloud.com>
 *
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program. If not, see <http://www.gnu.org/licenses/>
 *

etc
Did something happen to the php file?

The nextcloud config.php output is:

<?php
$CONFIG = array (
  'instanceid' => 'x',
  'passwordsalt' => 'x',
  'secret' => 'x/x',
  'trusted_domains' =>
  array (
    0 => 'x',
    1 => 'x',
    2 => 'x',
    3 => 'x',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'overwrite.cli.url' => 'https://x./nextcloud',
  'dbtype' => 'mysql',
  'version' => '20.0.10.1',
  'dbname' => 'webapp',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'x',
  'dbpassword' => 'x',
  'installed' => true,
  'maintenance' => false,
  'appstoreurl' => 'https://apps.nextcloud.com/api/v0',
  'theme' => '',
  'loglevel' => 2,
  'defaultapp' => 'calendar',
  'auth.bruteforce.protection.enaled' => true,
  'htaccess.RewriteBase' => '/nextcloud',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_from_address' => 'me',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'x',
  'mail_smtphost' => 'x',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'x',
  'mail_smtppassword' => 'x',
 'mail_smtpsecure' => 'ssl',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'app_install_overwrite' =>
  array (
    0 => 'mail',
    1 => 'ldapcontacts',
    2 => 'keeweb',
    3 => 'files_external_onedrive',
    4 => 'calendar',
    5 => 'qownnotesapi',
    6 => 'contacts',
  ),
  'updater.secret' => '$2y$x$w67r/x>
  'encryption.legacy_format_support' => true,
  'encryption.key_storage_migrated' => false,
);


Thank you in advance for your support!

Well I solved it, a lot of the php modules were not installed so I had to go one by one through each php module and install them all again.