How do I downgrade my php on my ubuntu linux?

When I try to start preview generator I get this error:
php /var/www/html/nextcloud/occ preview:pre-generate
This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running 8.1.4. I’m not sure why I have 7.4 and 8.1.4. I only install php7.2. I check the php from etc and there only 7.2 and 8.0. I delete 8.0 before this happen.

Php 8.1 is not officially supported by Nextcloud, but it is supported by the latest preview generator release. You should be able to use it; better still, you have a chance to help the developers improve it!

Let’s try to resolve your preview generator issue, because it should be fixable if you are on at least Nextcloud 21 or newer and can use 8.0 or 8.1 of php.

For bleeding edge PHP you will want to be on the latest stable release of Nextcloud 23.

Make sure you are on the latest 4.0.0 release of the preview generator app

It is the first release of “pg” to support beyond php 7.3, and should support 8.0 or even 8.1

If that doesn’t work check /var/www nextcloud.log for errors as admin user in top right right menu and report this as a new issue to the developer on github so they can fix it. :wink:

In the future, keep full system backups and never needlessly delete critical system files like previous php versions on an untested upgrade ever again, unless you know how to restore them. :smile: