I tried to switch the php version from 7.4 to 8.0 on my ubuntu operating system and wanted to use update-alternatives. I entered the following command, which broke everything:
sudo update-alternatives --install /etc/alternatives/php php /usr/bin/php8.0 1
This command must have been faulty, because now php is no longer found through cmd and any update-alternatives command returns update-alternatives: error: cannot stat file '/etc/alternatives/php': Too many levels of symbolic links
It must have something to do with the php-symlink under /etc/alternatives. It is marked as Link (broken) and the Link target is /etc/alternatives/php which is the file itself, brobably resulting in an infinite loop. Deleting the file and running update-alternatives again recreates the file, but with the same broken link target.
Any information on how to fix this is appreciated. Thanks!