I've recently updated my php and found, that the settings for apache did not match the php cli version. I had to set the cli version with the following procedure:
sudo update-alternatives --display php
This command lists all available php versions.
sudo update-alternatives --set php /usr/bin/php7.4
This command set the version I wanted.