installphp.info


← Back to home page

Install PHP 7.2 on Ubuntu 24.04

Warning! This PHP version is end-of-life!

PHP 7.2 reached end of life on 30 Nov 2020 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.

Installing PHP 7.2 on Ubuntu 24.04

Prerequisites

  • Ubuntu 24.04 system with sudo privileges
  • Terminal access
  • Internet connection

Installation

  1. Update the package list:
    sudo apt update
  2. Add the PPA for PHP 7.2:
    sudo add-apt-repository ppa:ondrej/php
  3. Update the package list again:
    sudo apt update
  4. Install PHP 7.2:
    sudo apt install php7.2
  5. Install common PHP extensions:
    sudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-mysql php7.2-xml php7.2-curl php7.2-mbstring php7.2-zip

Verification

  1. Check the PHP version:
    php -v
  2. Verify installed PHP modules:
    php -m
  3. Check PHP configuration:
    php --ini

If the installation was successful, you should see PHP 7.2 version information and a list of installed modules.