Table of Contents
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles!

How To Install PHP 8 on Debian 11

Author: Michael

Last Updated: Thu, Sep 9, 2021
Debian PHP


PHP is a popular server-side scripting language. This guide explains how to install PHP 8 on Debian 11.


To follow this guide:

Install PHP 8 on Debian 11

To install PHP 8 on Debian, you must set up the repository.

  1. Add the repository key.

    $ wget -qO - | sudo apt-key add -
  2. Add the repository.

    $ echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
  3. Update the package index.

    $ sudo apt update
  4. Install PHP 8.0 from the repository.

    $ sudo apt install php8.0
  5. Verify the PHP 8 installation.

    $ php -v


PHP extensions add new functionality to PHP.

  • To check the list of installed extensions:

    $ php -m
  • To find available extensions, see the extension list.

  • Use apt to install extensions:

    $ sudo apt install php8.0-{extension name}

    For example, to install the MySQL extension:

    $ sudo apt install -y php8.0-mysql

More Information

For more information on PHP 8, please see the official documentation

Want to contribute?

You could earn up to $600 by adding new articles