installphp.info


← Back to home page

Install PHP 7.1 on Debian 12

This version of PHP is actively supported.

Good news! PHP 7.1 is being actively supported through 20 Sep 2024. After that point, it's advisable to upgrade to the latest version, since the PHP team will only offer security-related support until 20 Sep 2024, at which point PHP 7.1 will be considered "end-of-life".

Installing PHP 7.1 on Debian 12

Prerequisites

  • Root access or sudo privileges on your Debian 12 system
  • A stable internet connection
  • Basic familiarity with command-line operations

Installation

  1. Update your system:
    sudo apt update && sudo apt upgrade -y
  2. Add the Sury PHP repository:
    sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common
    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 package list:
    sudo apt update
  4. Install PHP 7.1:
    sudo apt install -y php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm

Verification

  1. Check PHP version:
    php -v
  2. Verify PHP modules:
    php -m
  3. Check PHP-FPM status:
    sudo systemctl status php7.1-fpm