VPS & DedicatedLinux

Install PHP

Install PHP 8.1 (or any other version) on Debian or Ubuntu.

Pick your operating system below. In the commands, 8.1 can be replaced with any valid PHP version.

Add the PHP repository for Debian:

bash
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL https://packages.sury.org/php/apt.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg

Update the repositories and install PHP 8.1:

bash
apt update -y
apt install -y php8.1 php8.1-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip}