installphp.info


← Back to home page

Install PHP 8.2 on Ubuntu 22.04

This version of PHP is actively supported.

Good news! PHP 8.2 is being actively supported through 31 Dec 2024. After that point, it's advisable to upgrade to the latest version, since the PHP team will only offer security-related support until 31 Dec 2026, at which point PHP 8.2 will be considered "end-of-life".

Installing PHP 8.2 on Ubuntu 22.04

Prerequisites

  • Ubuntu 22.04 LTS installed
  • Root or sudo access
  • Terminal access
  • Internet connection

Installation

  1. Update the package list:

    sudo apt update
  2. Add the PHP repository:

    sudo add-apt-repository ppa:ondrej/php
  3. Install PHP 8.2:

    sudo apt install php8.2
  4. Install common PHP extensions:

    sudo apt install php8.2-common php8.2-mysql php8.2-xml php8.2-curl php8.2-gd php8.2-mbstring php8.2-zip

Verification

  1. Check the PHP version:

    php -v

    This should display PHP 8.2.x information.

  2. Verify PHP configuration:

    php -i

    This will show detailed PHP configuration information.

  3. Check installed modules:

    php -m

    This will list all installed PHP modules.