installphp.info


← Back to home page

Install PHP 8.2 on Debian 10

Warning! This version of PHP is outdated.

PHP 8.2 reached end of active support on 31 Dec 2024. As of today, PHP 8.2 is only receiving security related updates through 31 Dec 2026, at which point it will be considered end-of-life and receive no further updates. It's strongly recommended to upgrade to the latest version of PHP before then.

Installing PHP 8.2 on Debian 10

Prerequisites

  • Debian 10 (Buster) installed and updated
  • Root or sudo access to the system
  • Command-line/terminal access

Installation

  1. Add the Sury PHP repository:

    sudo apt update
    sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common
    sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
  2. Update package list:

    sudo apt update
  3. Install PHP 8.2 and common extensions:

    sudo apt install -y php8.2 php8.2-cli php8.2-common php8.2-curl php8.2-mbstring php8.2-xml php8.2-zip

Verification

  1. Check PHP version:

    php -v

    You should see output indicating PHP 8.2.x is installed.

  2. Verify installed modules:

    php -m

    This will list all installed PHP modules.

  3. Create a test PHP file:

    echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/phpinfo.php
  4. Access the phpinfo page in your web browser:

    http://your_server_ip/phpinfo.php

    This page will display detailed information about your PHP installation.