---
title: How To Install PHP 8 on Debian 11
url: https://docs.vultr.com/how-to-install-php-8-on-debian-11
description: Learn how to install PHP 8 on Debian 11 with our step-by-step guide. Discover multiple installation methods and essential configuration tips for optimal performance.
publish_date: 2021-09-09T00:00:00Z
last_updated: 2025-04-23T20:05:08.661187Z
header_image: https://assets.vultrdevrel.com/docs-main-doc-assets-1/1005/63845395caf828a6.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

## Introduction

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

## Prerequisites

To follow this guide:

* [Deploy a Debian 11 cloud server at Vultr](https://console.vultr.com/deploy/).
* [Update the server](https://docs.vultr.com/how-to-update-a-vultr-cloud-server#how-to-update-debian--ubuntu).
* Create a non-root user with sudo privileges.

## Install PHP 8 on Debian 11

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

1. Add the repository key.

        $ wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -

1. Add the repository.

        $ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list

1. Update the package index.

        $ sudo apt update

1. Install PHP 8.0 from the deb.sury.org repository.

        $ sudo apt install php8.0

1. Verify the PHP 8 installation.

        $ php -v

## Extensions

PHP extensions add new functionality to PHP.

* To check the list of installed extensions:

        $ php -m

* To find available extensions, [see the extension list](https://www.php.net/manual/en/extensions.php).
* 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](https://www.php.net/docs.php)
