installphp.info


← Back to home page

Install PHP 8.2 on Ubuntu 24.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 24.04

Prerequisites

  • Ubuntu 24.04 system
  • Root or sudo privileges
  • Terminal access
  • Internet connection

Installation

  1. Update the system 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-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip

Verification

  1. Check PHP version:
    php -v

    You should see output similar to:

    PHP 8.2.x (cli) (built: ...) (...)
  2. Verify installed PHP modules:
    php -m
  3. Check PHP configuration:
    php --ini