How to Install Latest PHP 8 on Debian 10

Install PHP 8 on Debian 10

In this article, we will have explained the necessary steps to install and set up PHP 8 on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

PHP is a recursive acronym for Hypertext Preprocessor and is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. Many popular CMS and frameworks such as WordPress, Laravel, and many more are built in PHP. As of right now, PHP 8.0 is on track to be released on November 26th, 2020. The release process is in feature freeze now and we’ll have 4 betas and 5 release candidates before we get the final version ( for all the dates).


  • Operating System with Debian 10
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install PHP 8 on Debian 10

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade
sudo apt install apt-transport-https lsb-release ca-certificates wget curl

Step 2. Install PHP 8 on the Debian system.

Download the SURY PPA for PHP and then set up the apt repository for it:

sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

Install PHP GPG key of Sury:

curl -sSL -o /etc/apt/trusted.gpg.d/php.gpg

Then, run the following commands to install PHP 8 on Debian 10:

sudo apt install php8.0 php8.0-fpm php8.0-curl php8.0-mysqlnd php8.0-zip php8.0-mbstring php8.0-xml

In order to check the version number of your installed PHP, run the following command:

$ php8.0 -v
PHP 8.0.0 (cli) (built: Dec 12 2020 16:22:12) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

Step 3. Install PHP extensions.

PHP extensions are compiled libraries that extend the core functionality of PHP. Extensions are available as packages and can be easily installed with apt:

sudo apt install php8.0-[module]

For example:

sudo apt install php8.0-devel

Step 4. Testing PHP.

Now, create a test PHP file called info.php in the webserver default home directory:

sudo nano /var/www/html/info.php

And add the following line:


Once upon, open your browser and browse to the server hostname or IP address followed by the name of the file you created above:


That’s all you need to do to install the PHP on Debian 10 Buster. I hope you find this quick tip helpful. For further reading on PHP 8, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.