Server update debian 11 to 12, how to upgrade NC from version 25 to version 27?

I was trying to find possible reasons for the following…

…and then I was trying to tell you what I’m doing to make sure I only have one major version of PHP installed on my system.

Well, in that case they may be leftovers from a previous installation attempt, or another package may have pulled them as a dependency.

# Install PHP 8.1
apt-get -y install php8.1-fpm php8.1-mysql php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-curl php8.1-redis php8.1-intl php8.1-bcmath php8.1-gmp php8.1-imagick imagemagick

I just tested that exact command in a fresh Debian LXC and this is how the /etc/php folder looks like:

ls -al /etc/php/
total 12
drwxr-xr-x  3 root root 4096 Feb 11 12:21 .
drwxr-xr-x 69 root root 4096 Feb 11 12:22 ..
drwxr-xr-x  5 root root 4096 Feb 11 12:21 8.1
root@lxc-test:~# 

So again, not sure why there are 7.4 and 8.3 folders on your system, and sorry if my previous post wasn’t helpful.

You could try to purge PHP completly from your system, which should also remove all config files including the /etc/php folder, and then try to install PHP 8.1 again.

apt-get remove --purge php* && apt-get autoremove

EDIT:
Or maybe you could use → the php-updater script ← by @ernolf. But I never tested it myself