Failed to connect to the database with php 7.3 or php 8.0

Good evening to all,

I come to see you because I wanted to follow the security advices which indicate me that I had missing indexes that I had to solve with a classic sudo -u www-data php occ db:add-missing-indices.

By doing that I realized that my php version was not up to date, I was in 7.3.

So I wanted to go to 8.0 and there the beginning of the problems started …

The problems of indexes disappeared except that another problem arrived ( attached screen of the current problem )

I obviously looked at the other posts about this, but for the moment none of them could solve my error … (I am in particular to go in those located below.

The last link is the error I encountered when I switched to php8.0

At the moment my site is totally unavailable, so I wanted to switch back to php7.3 and I deleted all the packages from 8.0 but without success the site remains unavailable.

Below are the results of a php -v

PHP 7.3.27-9+0~20210227.82+debian10~1.gbpa4a3d6 (cli) (built: Feb 27 2021 15:50:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.27-9+0~20210227.82+debian10~1.gbpa4a3d6, Copyright (c) 1999-2018, by Zend Technologies