How to Install PHP 8 on Debian 10

Recently stable version of PHP 8 has been released. This version comes with lot of advance features and improvements. In this guide, we will demonstrate on how to install PHP 8 on a Debian 10 system step by step.

Minimum requirements for PHP 8:

  • Debian 10 Installed system
  • Local user with sudo rights
  • Internet connection

Let’s jump into PHP 8 installation steps on Debian 10 system,

Step 1) Install updates with apt command

Login to your Debian 10 system with the local user and install all available updates using apt commands,

Note: In case you don’t want to install updates then you skip this step and then move to step 2

[email protected]:~$ sudo apt update
[email protected]:~$ sudo apt upgrade -y

Once all the updates are installed successfully and then reboot your system using below reboot command,

[email protected]:~$ sudo reboot

Step 2) Enable PHP 8 Repository (SURY PPA)

PHP 8 packages are not available in the default Debian 10 package repositories. So, to install php 8 first we have to enable SURY PPA,

Run the Following commands one after the another

[email protected]:~$ sudo apt install -y lsb-release apt-transport-https ca-certificates wget
[email protected]:~$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg
[email protected]:~$ echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

Run below ‘apt update’ command after enabling SURY PPA repository to update package index.

[email protected]:~$ sudo apt update


Above output confirms that we are ready to install php 8 on Debian 10 system,

Step 3) Install PHP 8 using apt command

To install php 8 for apache web server and other web applications, run the following command

[email protected]:~$ sudo apt install php8.0 -y

To Install PHP 8 FPM for NGINX Web server, run the following command

[email protected]:~$ sudo apt install php8.0-fpm -y

To install PHP extensions, run the following

$ sudo apt install php8.0-{extensions-name}

Let’s assume we want to install php extensions like mysql, cli, common, snmp, ldap, curl, mbstring and zip

[email protected]:~$ sudo apt install -y php8.0-{mysql,cli,common,snmp,ldap,curl,mbstring,zip} -y

To Verify the PHP version, execute below php command,

[email protected]:~$ php -v
PHP 8.0.0 (cli) (built: Dec  6 2020 06:56:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies
[email protected]:~$

To list all the loaded PHP modules, run beneath php command,

[email protected]:~$ php -m

Step 4) Configure PHP 8 for Web Applications

To configure PHP 8 for the web applications like apache web server, edit its configuration file ‘/etc/php/8.0/apache2/php.ini’, add or change the below parameters that suits to your application

[email protected]:~$ sudo vi /etc/php/8.0/apache2/php.ini
upload_max_filesize = 16M
post_max_size = 30M
memory_limit = 128M
max_execution_time = 500
max_input_vars = 2000
max_input_time = 1000

Save & close the file. To make the above changes into the effect restart the Apache service

[email protected]:~$ sudo systemctl restart apache2

To configure php 8 fpm for NGINX web server, edit its configuration file ‘/etc/php/8.0/fpm/pool.d/www.conf‘ and set the parameters that suits to your nginx server setup. After making the changes to file, don’t forget to restart php 8 fpm service

[email protected]:~$ sudo systemctl restart php8.0-fpm

Step 5) Test PHP 8 via Web Browser

Let’s create info.php file under apache web server document root,

[email protected]:~$ sudo vi /var/www/html/info.php

Save & exit the file and restart apache service using the following systemctl command

[email protected]:~$ sudo systemctl restart apache2

Now open the Web browser and type the following URL:



Perfect, above screen confirms that PHP 8 has been installed successfully on Debian 10 system. That’s all from this guide, please don’t hesitate to share your feedback and comments in the comments section below.

2 thoughts on “How to Install PHP 8 on Debian 10”

  1. Hello,
    Thanks for your tutorial.
    I flow your instruction but I got at the end PHP Version 7.3.28-2+0~20210604.85+debian10~1.gbp219f11.
    I use Debian 10 on root server und also ISPConfig.
    I will be glad, if you could help me.
    Thanks und best Regards,

    • Hi Joseph,
      It seems like apt have used default Debian 10 package repositories for installing PHP 8.
      Please cross check whether you have enabled php 8 repository and updated the repositories using ‘apt update’ command


Leave a Comment