I’ve recently installed Apache2 and MariaDB on my server, set up a database and user for Nextcloud, and then installed Nextcloud by moving the files to /var/www/html/nextcloud/. After configuring the Apache2 virtual host, I was expecting to see the Nextcloud setup page when accessing the site, but instead, I see the raw index.php file displayed in my browser.
The index.php what i become when i try to set up nextcloud;
It may also be helpful to align the directory section in your configuration with that in the official documentation, specifically by adding/extending the following two lines:
Require all granted
Options FollowSymLinks MultiViews
If you are on Debian or Ubuntu, you could upgrade your system to the latest release, Debian 12 or Ubuntu 24.04, which ship with PHP 8.2 or 8.3 respectively. Or, if you can’t upgrade your distribution for some reason, you could try the following script: Php-updater - a script to upgrade php in a safe way
The issue was that i tried to install on Debian os but then I was not able to install PHP latest version so I installed again on Ubuntu and problem solved