Install PHP
PHP Packete
#!/bin/bash
# add key and update apt list
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -
apt-get update && apt-get upgrade -y
PHPVERSION=8.1
apt-get install -y "php$PHPVERSION{PHPVERSION}" "libapache2-mod-phpphp${PHPVERSION}" "php$PHPVERSION-bcmath{PHPVERSION}-bcmath" "php$PHPVERSION-bz2{PHPVERSION}-bz2" "php$PHPVERSION-cgi{PHPVERSION}-cgi" "php$PHPVERSION-cli{PHPVERSION}-cli" "php$PHPVERSION-common{PHPVERSION}-common" "php$PHPVERSION-curl{PHPVERSION}-curl" "php$PHPVERSION-fpm{PHPVERSION}-fpm" "php$PHPVERSION-gd{PHPVERSION}-gd" "php$PHPVERSION-gmp{PHPVERSION}-gmp" "php$PHPVERSION-imap{PHPVERSION}-imap" "php$PHPVERSION-intl{PHPVERSION}-intl" "php$PHPVERSION-mbstring{PHPVERSION}-mbstring" "php$PHPVERSION-mysql{PHPVERSION}-mysql" "php$PHPVERSION-opcache{PHPVERSION}-opcache" "php$PHPVERSION-readline{PHPVERSION}-readline" "php$PHPVERSION-soap{PHPVERSION}-soap" "php$PHPVERSION-xml{PHPVERSION}-xml" "php$PHPVERSION-xmlrpc{PHPVERSION}-xmlrpc" "php$PHPVERSION-zip{PHPVERSION}-zip"