Debian Mint

How to Install PHP 8.0 on Debian / Mint

Originally developed by Rasmus Lerdorf, a Danish-Canadian developer, PHP is a server-side scripting language that is geared towards the development of both dynamic and static webpages. PHP is a recursive acronym for PHP Hypertext Preprocessor but was initially an acronym for Personal Home Page. Currently, two PHP releases are receiving active support – PHP 7.4 and PHP 8.0.

The most current and stable release is PHP 8.0. It was released on Nov 16, 2020, and enjoys support until 2023provides improvements and enhancements such as named arguments, null safe operator, union types, JIT (Just In Type) compiler, and improvements in consistency and error-handling.

In this tutorial, we will demonstrate the installation of PHP 8.0 on Debian / Linux Mint.

Step 1: Update the system

To get off the ground, we are going to update the package list of the system.

$ sudo apt update

Once updated, install the dependencies required.

$ sudo apt install software-properties-common ca-certificates lsb_release apt-transport-https

Step 2: Enable the Sury APT repository

The next step is to add the SURY repository to our system. SURY is a third-party PHP repository that packages PHP packages for Debian. To add the repository, run the command

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

Next, import the repository’s GPG key.

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

Step 3: Install PHP 8.0

To install PHP 8.0, update the package lists to sync with the newly added SURY repository

$ sudo apt update

Then install PHP 8.0 on Debian Buster as follows.

$ sudo apt install php8.0

Once installed, verify the PHP release installed:

$ php -v

Additionally, you can install PHP extensions using the syntax:

$ sudo apt install php-extension

If you are installing multiple extensions, specify them inside the curly braces as shown. In this example, we are installing the php-cli, php-mbstring, php-xml, php-common, php-ldap the php-curl extensions.

$ sudo apt install php8.0-{cli,mbstring,xml,common,ldap,curl}

Conclusion

And that’s how to install PHP 8.0 on Debian 10. We wish you an eventful time in your web development!

Similar Posts