The logo for PHP version 8.0

Installing PHP8.0-FPM on Debian 11

PHP-FPM is a session manager used for handling the use of multiple versions of PHP, on the same host. PHP-FPM is commonly used by web hosting providers to provide multiple versions of PHP on the same shared host, but PHP-FPM is great when you’re running two different PHP applications on the same server that require different PHP versions.

PHP7.4 is the only current version of PHP-FPM available in the default Debian 11 repositories, as seen in the screenshot below. So, some additional steps are required to make PHP8.0 available

Search of the default Debian 11 repositories looking for PHP-FPM versions

1. Update Repositories and Install the Prerequisites

First, install a few software libraries that are required in order to add the new software repository, safely.

$ sudo apt update
$ sudo apt install -y install apt-transport-https lsb-release ca-certificates curl

2. Import the Repository Key

In order for apt to communicate with the repository securely, it needs the public key available for the repo. The below command adds the public key for the sury-php repository to apt.

A software developer by the name of Ondřej Surý who has been providing the official builds of PHP on both Ubuntu and Debian repos via his website since 2000.

$ sudo curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg

3. Add the Repository

This will create the appropriate package details for your kernel version and save it in /etc/apt/sources.list.d/sury-php.list.

$ sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

4. Update APT Repositories

The following command updates the local APT cache from the available repositories.

$ sudo apt update

5. Install PHP8.0-FPM

Now, you can simply install PHP8.0-fpm via APT.

$ sudo apt install php8.0-fpm

PHP-FPM is installed to /etc/php/php8.0/fpm. The php.ini file contained within that directory controls the PHP configuration for instances of FPM running that version of PHP.