I recently upgraded to the latest version of PHP, which was, at the time, PHP8; the problem is that Nextcloud will often not work on the latest version of PHP. The reason for this is that PHP sometimes introduces backward incompatible changes, in which case developers will need to update their software before it will work with the latest version.
This may result in an error like this:
This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running PHP8.0.
There is at least a few solutions to this problem, depending on your needs and circumstances. The least expensive is to simply run multiple versions of PHP on the same server; but another solution would be to setup an extra instance in Azure or AWS.
The problem with setting up an extra server is that you will need to use a subdomain. My Nextcloud installation is running in a subdirectory in one of my VHOSTs. I.e.: example.com/nextcloud/, and so, I would have to also re-install nextcloud for that to work.
Instead I found out I could just run multiple versions of PHP, and also save money by not having to run more instances. This problem has happened to me before, where I had to revert to an older version of PHP and wait for Nextcloud to update.
Since nothing on the domain running Nextcloud needs PHP8, I simply included the php7.4-fpm configuration file in the VirtualHost block in the VHOST configuration of the domain name.
The cool thing about this solution is that it also works for Drupal, Wordpress, and other things you might need to run.
Nextcloud might not support PHP8 until sometime next year.