Alright so this is what worked for me:
First I copied my wp-config file to a separate directory folder as a backup (just in case I messed something up).
Then I installed a fresh version of wordpress onto my server
cd /tmp
curl -LO https://ww.wp.xz.cn/latest.tar.gz
Next I extracted the file
tar xzvf latest.tar.gz
Then I copied the new wordpress install right into my current website directory. Using the -a flag to maintain permissions
sudo cp -a /tmp/wordpress/. /var/www/<your-wp-directory>
Finally I added all the files to my www-data group
sudo chown -R www-data:www-data /var/www/<your-wp-directory>
After that it all worked again! I used this tutorial to help me with the new wordpress install. Check it out if my instructions weren’t clear enough.
I get the same error but ONLY when I use php7.4 I hope someone can solve this.