installphp.info


← Back to home page

Install PHP 7.3 on Debian 11

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

PHP 7.3 reached end of life on 06 Dec 2021 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.3 on Debian 11

Prerequisites

  • A Debian 11 system with root or sudo access
  • A stable 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
    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.3 and common extensions:
    sudo apt install php7.3 php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml

Verification

  1. Check the installed PHP version:
    php -v
  2. Verify PHP configuration:
    php -i
  3. Create a test PHP file:
    echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/phpinfo.php
  4. Access the test file in your web browser:

    http://your_server_ip/phpinfo.php