Skip to content

Installing PHP 8.0 on Debian 11/10/9

Tutorials & Guides  ·  Christopher Sakel  ·   ·  Updated on  ·  1 min Reading time

In this blog article, I want to show you how to install PHP 8 on Debian 9/10/11.

First, we log in to the server via SSH, e.g. with Putty.

Now we run the following command:


  1. Update the server:
    root@testserver ~ # apt update
  2. Install the required packages:
    root@testserver ~ # apt install sudo lsb-release ca-certificates apt-transport-https software-properties-common -y
  3. Download and add the public key for the repository:
    root@testserver ~ # wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
  4. Add the repository:
    root@testserver ~ # echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
  5. Update the server:
    root@testserver ~ # apt update
  6. Install PHP 7.4:
    root@testserver ~ # apt install php8.0 -y

Now we can check the PHP version with the following command:

root@testserver:~# php -v
PHP 7.8.0 (cli) (built: Jun 30 2021 20:40:09) ( NTS )
Copyright (c) The PHP Group

Frequently asked questions

How do I update the server before installing PHP?
Run apt update to refresh the package lists.
Where does the PHP 8 package come from?
From the Sury repository, added via its public key and an entry in /etc/apt/sources.list.d/sury-php.list.
How do I check which PHP version is installed?
Run php -v on the server.