Add a Linux repository that includes all PHP versions:
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
Install PHP in Apache
$ sudo apt update
$ sudo apt install php8.0 libapache2-mod-php8.0
$ sudo systemctl restart apache2
Installing PHP extensions:
$ sudo apt install php8.0-{Extension-Name}
Example
$ sudo apt install php8.0-xml php8.0-intl
For Magento install below PHP extensions:
- ext-bcmath
- ext-ctype
- ext-curl
- ext-dom
- ext-gd
- ext-hash
- ext-iconv
- ext-intl
- ext-mbstring
- ext-openssl
- ext-pdo_mysql
- ext-simplexml
- ext-soap
- ext-xsl
- ext-zip
- ext-sockets