
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.
- Update the server.
- 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.
Add the repository key.
$ wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
Add the repository.
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
Update the package index.
$ sudo apt update
Install PHP 8.0 from the deb.sury.org repository.
$ sudo apt install php8.0
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.
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
Related Content
How to Install PHP and PHP-FPM on Debian 12
March 29, 2025
Article
Upgrade From PHP 7 to PHP 8 on Ubuntu 20.04 with Apache
January 23, 2025
Article
How to Install PHP and PHP-FPM on Ubuntu 24.04
July 25, 2024
Article
How to Install PHP 5.6 on Ubuntu 24.04
April 4, 2025
Article
No comments yet.