installphp.info


← Back to home page

Install PHP 7.4 on Debian 10

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 Debian 10

Prerequisites

  • A Debian 10 (Buster) system with root or sudo access
  • A working internet connection
  • Basic knowledge of command-line operations

Installation

  1. Update the package list:

    sudo apt update
  2. Add the Sury PHP repository:

    sudo apt -y install lsb-release apt-transport-https ca-certificates
    sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
  3. Update the package list again:

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

    sudo apt install -y 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 indicating PHP 7.4.x is installed.

  2. Verify PHP CLI is working:

    php -r "echo 'Hello, PHP 7.4!';"

    This should output: Hello, PHP 7.4!

  3. Check installed PHP modules:

    php -m

    This will list all installed PHP modules.