installphp.info


← Back to home page

Install PHP 7.4 on Ubuntu 22.04

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

PHP 7.4 reached end of life on 28 Nov 2022 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.4 on Ubuntu 22.04

Prerequisites

  • Ubuntu 22.04 LTS installed and updated
  • Root or sudo access to the system
  • Terminal access

Installation

  1. Add the PHP repository:

    sudo add-apt-repository ppa:ondrej/php
  2. Update the package list:

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

    sudo apt install php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-mbstring php7.4-mysql php7.4-xml

Verification

  1. Check the installed PHP version:

    php -v

    You should see output similar to:

    PHP 7.4.x (cli) (built: ...)
  2. Verify PHP configuration:

    php -i

    This will display detailed PHP configuration information.

  3. Check installed PHP modules:

    php -m

    This will list all installed PHP modules.