installphp.info


← Back to home page

Install PHP 7.4 on Ubuntu 20.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 20.04

Prerequisites

  • Ubuntu 20.04 LTS installed
  • User account with sudo privileges
  • Terminal access
  • Internet connection

Installation

  1. Update the package list:

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

    sudo apt install php7.4 php7.4-cli php7.4-fpm php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath
  3. When prompted, confirm the installation by pressing 'Y' and then 'Enter'.

Verification

  1. Check the installed PHP version:

    php -v
  2. You should see output similar to:

    PHP 7.4.x (cli) (built: ...) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.x, Copyright (c), by Zend Technologies
  3. Verify installed PHP modules:

    php -m