How to install PHP 8 on Debian 10?

On 26th November 2020, PHP introduced its latest and stable PHP 8.0 which is a major update of the PHP language. The codebase is completely new and will not be compatible with the earlier versions of PHP.


The latest version PHP 8 contains many new features and optimizations including named arguments, union types, attributes, constructor property promotion, match expression, null safe operator, JIT (Just in Time), and improvements in the type system, error handling, and consistency.

Developers and many hosting companies are updating their codes and servers for the latest version of the PHP and in this article, we’ll see how to install the latest PHP 8 on Debian 10.

This will also work on all Debian-based distributions.

First, install the prerequisites.

apt install lsb-release apt-transport-https ca-certificates wget -y

Download the SURY PPA for PHP and then set up the apt repository for it.

wget -O /etc/apt/trusted.gpg.d/php.gpg
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Update the repository index.

apt update

Once updated, you can install the latest PHP 8 or earlier ones too.

apt install php8.0-{fpm,cli,common,curl,gd,mbstring,mysql,xml,zip} -y

You can customize the list of modules as per your needs.

Just restart the PHP service and board on.

Category: .

Leave a Reply

Your email address will not be published. Required fields are marked *