norge you can use the command:
sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.
sudo apt-get update
sudo apt install php7.4 php7.4-common php7.4-cli
then Install required extensions
sudo apt install php7.4-curl php7.4-json php7.4-gd php7.4-mbstring php7.4-intl php7.4-bcmath php7.4-bz2 php7.4-readline php7.4-zip
To integrate PHP with your web server, If you are using Nginx, or Apache with mod_event, you will need to install php7.4-fpm package. If you are using PHP as an embedded Apache module, you will need the package libapache2-mod-php7.4. For Apache, you can use apachectl -V to see your current MPM, whether it’s prefork or event.
Nginx or Apache with event MPM:
sudo apt install php7.4-fpm
Apache with prefork MPM:
sudo apt install libapache2-mod-php7.4
sudo a2enmod php7.4
To remove previous version
sudo apt purge php7.3 libapache2-mod-php7.3 # For removing PHP 7.3
To verify the installation of PHP 7.4
php -v
This should work but use at your own risk.