How to Install PHP 8.2 on Debian 11

PHP is a script language and interpreter that is freely available and used primarily on Linux Web servers.

To install PHP 8.2, we’ll need to add/ PHP PPA repositories which contain the PHP 8.2 packages that we need.

Pre-requisites :

  • A system with Debian 11 installed and running.

  • root access to the system.

To Ensure system updated.

apt update

If any update is available update the system and reboot.

apt upgrade -y && reboot

Add SURY PHP PPA repository

First download GPG key.

apt -y install lsb-release apt-transport-https ca-certificates 
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Next, add SURY to the repository.

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list

Output:

deb https://packages.sury.org/php/ buster main

Install PHP 8.2

Ensure the added package is up to date.

apt update

If any update is available update the system and reboot.

apt upgrade -y && reboot

Install PHP 8 on Ubuntu

apt install php8.2 -y

To check PHP Version.

php -v

Output:

root@vps:~# php -v
PHP 8.2.0 (cli) (built: Dec  8 2022 15:03:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
        with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies

To Install php Extensions.

NOTE: Replace the required extensions name in the command

apt install php8.2-<extension>

To list installed php modules/extensions.

php -m

This concludes our topic of installing PHP 8.2 on the Debian 11 system.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS