Here it is

  1. Add the repo
    First download the repo GPG key:
    sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
    
    Then add the repo:
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
    
  2. After adding the repo, update apt and install:
    sudo apt update && sudo apt install php7.4 -y
    
    Install other PHP packages in similar fashion.
    For example:
    sudo apt install php7.4-mysql php7.4-fpm -y
    


Source: https://computingforgeeks.com/how-to-install-latest-php-on-debian/