Introduction
PHP (Hypertext Preprocessor) is a popular open-source server-side scripting language used for web development. It is designed specifically for building dynamic websites and web applications. PHP is often embedded in HTML code and runs on a web server, generating dynamic content and allowing interaction with databases.
PHP 8.0 contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, null safe operator, JIT, improvements in the type system, error handling, and consistency.
In this article, we will explain how to install PHP 8 on Debian 11.
Install PHP 8
- Update and upgrade the package index.
$ sudo apt update
$ sudo apt upgrade - Install the required dependencies to install PHP 8.
$ sudo apt install apt-transport-https lsb-release ca-certificates wget
- Add PHP repository.
$ sudo echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
- Again update the package index.
$ sudo apt update
- Install PHP 8.0.
$ sudo apt install php8.0
- Verify the PHP version.
$ php -v
Output