sudo apt update
sudo apt install php7.4
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
# php -v (default PHP version)
# From PHP 8.0 to PHP 7.4:
sudo a2dismod php8.0
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart
# From PHP 7.4 to PHP 8.0:
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo update-alternatives --set php /usr/bin/php8.0
sudo service apache2 restart
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.0
#install common extension
sudo apt install php8.0-common php8.0-mysql php8.0-xml php8.0-xmlrpc php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip php8.0-intl -y
sudo a2dismod php7.0
sudo a2dismod php7.1
sudo a2dismod php7.2
sudo a2dismod php7.3
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo service apache2 restart
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php7.4
#Rn the command as sudo
• apt install software-properties-common
• apt update
• apt install php8.0
php7 extensions installations