The latest version of PHP is 8.1, which now has an improved syntax and new features for better performance. This tutorial will help you install the latest release on Debian 11/10 systems.
Installing the latest version of PHP 8.1 on Debian 11/10 can be a difficult process. This is because the new version requires compiling from source, which is not as easy as installing it through apt-get or yum.
Debian is a safe and reliable Linux-based operating system distribution that provides web-based applications with unmetered server performance. Improved security, compatibility for exFAT file systems, and support for many languages are all enhancements that go hand in hand with a variety of web-based apps in Debian 11 “Bullseye.”
The JIT compiler for web programs is one of the most important innovations and advancements in PHP 8. Improved numerical code performance, better PHP web application code execution and speed, and possibly faster PHP code owing to supporting C to PHP code transfer are just a few of the advantages.
Strict type checks, particularly for Bitwise/Arithmetic operators, saner numeric strings, nullsafe operator, named arguments, weak maps, throw expression, and constructor property promotion are among the other important new/improved features in PHP 8.
This tutorial will show you how to install PHP 8 on Debian 11/10.
On the Debian 11 system you’re using, have root/sudoer user rights.
PHP 8 installation on Debian Linux
On top of implementing the necessary security updates, updating your Debian system guarantees that it remains in the best possible condition.
$ sudo apt update && sudo apt upgrade -y
If you have an earlier PHP version, such as 7.x, you should remove it so that you can take use of PHP 8’s features and enhancements.
$ sudo apt remove –purge php* Remove PHP in Debian
After that, install the PHP 8 installation requirements as well as the UFT-8 Unicode standard.
apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 $ sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 locale-gen en US.UTF-8 $ sudo locale-gen en US.UTF-8
Now add the Ondej Sur PPA repository to your Debian 11 system, which will be responsible for tracking, getting, and installing the newest PHP version.
echo $ “debbie $(lsb release -sc) main https://packages.sury.org/php/ “| sudo tee /etc/apt/sources.list.d/sury-php.list | sudo tee /etc/apt/sources.list.d/sury-php.list wget -qO – https://packages.sury.org/php/apt.gpg $ sudo wget -qO – https://packages.sury.org/php/apt.gpg —keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian-php-8.gpg —import sudo gpg —no-default-keyring —keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian-php-8.gpg chmod 644 /etc/apt/trusted.gpg.d/debian-php-8.gpg $ sudo chmod 644 /etc/apt/trusted.gpg.d/debian-php-8.gpg
Update the Debian system to acknowledge the inclusion of the Ondej Sur PPA repository after adding it. If future PHP versions are available, updating to them will be as easy as running the following Debian 11 system update command:
$ sudo apt update && sudo apt upgrade -y
Finally, on Debian 11, install PHP 8.1.
$ sudo apt install php8.1 Install PHP in Debian
Verify the PHP version that is installed.
$ php –version Check PHP in Debian
Use the following syntax to install additional PHP extensions:
apt install php8.1-name of extension $ sudo apt install php8.1-name of extension
To install a php-fpm extension, for example, we’ll use the following command:
apt install php8.1-fpm $ sudo apt install php8.1-fpm
We learned how to install PHP and any of its related extensions on Debian 11 in this tutorial. You’re now ready to start working on your web-based projects or apps.
The “debian 11 php version” is a command that allows users to view the current version of PHP installed on their system. The command will also show what versions are available for installation and what dependencies must be met.
Frequently Asked Questions
How to upgrade PHP in Debian?
A: You can upgrade PHP by running the following command.
apt-get install php7mfpm
If you are using Debian 9, please use apt-get instead of dpkg for more information and help on how to install packages from it.
How do I upgrade PHP to 8?
A: Upgrade to PHP 8.0, then upgrade your application to use it.
How do I download PHP on Linux?
A: I am not a website that you can download, but the command to download PHP on Linux would be apt-get install php5. You may need to use other commands depending on your distribution.
- install php 8 debian
- how to install php on debian 11
- debian change php version
- debian remove php 8
- debian bullseye php 8