HomeHow ToHow to install PHP...

How to install PHP 5.6 and 7.0 – 8.4 with PHP-FPM and FastCGI mode for ISPConfig 3.2 with apt on Debian 11 to 12

When using ISPConfig, by default, you only have the main PHP version for your distribution. This guide will take you through installing additional PHP versions (5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.1, 8.2, 8.3 and 8.4) on a Debian server with ISPConfig.

After installing the additional versions, you can select them for use on specific websites in both PHP-FPM and FastCGI mode.

1 Preliminary Note

In this guide, you will add the SURY repository additional repository to install the PHP packages from with apt. Because other packages as OpenSSL, are updated too, the installed packages from sury.org can not simply be removed after installation. So do not remove SURY as a repository source later on.

Please note that PHP-FPM can be used on Apache and Nginx servers, while FastCGI is available only for Apache servers.

Choose Your Repository Configuration Method

Debian provides two approaches for adding the Sury PHP repository. The extrepo method handles GPG keys and repository configuration automatically, while manual configuration offers full control over repository settings.

MethodGPG Key ManagementDebian SupportSteps RequiredBest For
extrepo (Recommended)Automatic11, 12, 133 commandsMost users; quick setup with minimal configuration
Manual RepositoryManual download11, 12, 135 commandsScripted deployments, custom configurations, or learning APT internals

For most users, the extrepo method is recommended because it simplifies repository management and reduces manual steps. Debian’s extrepo tool maintains a curated list of external repositories with verified GPG keys, making it the safest approach for adding third-party sources.

Choose Your PHP Version for Debian

Compare Supported PHP Releases

Each PHP version targets different support lifecycles and compatibility needs. Debian’s default repositories provide stable PHP versions maintained by the Debian security team, while the Sury repository offers current releases with upstream security support.

PHP VersionPrimary FocusPerformanceBest ForTrade-offs
PHP (Distro Default)Stability with Debian security team maintenanceVaries by version; Debian 12’s PHP 8.2 includes JIT compilation and OPcacheProduction servers prioritizing official Debian updates and minimal external dependenciesVersion varies by release (8.4 on Debian 13, 8.2 on Debian 12, 7.4 on Debian 11)
PHP 8.5Pipe operator, URI extension, clone with properties, array helpersImproved JIT and continued IR-based JIT framework refinementsProjects leveraging function chaining, advanced URL handling, or needing array_first()/array_last()Newest release; requires Sury repository on all Debian versions
PHP 8.4Property hooks, asymmetric visibility, HTML5 DOM APIContinued JIT improvements; new IR-based JIT frameworkProjects using modern OOP patterns, applications requiring array_find() and BCMath object APIRequires Sury repository on Debian 11/12; available in Debian 13 default repositories
PHP 8.3Typed class constants, json_validate(), readonly property cloningMature JIT optimization with broad extension compatibilityWordPress 6.x, Laravel 11, Drupal 10 sites needing stable features with security support through December 2027Requires Sury repository on all Debian versions; community-maintained updates

Recommendation: Choose PHP 8.3 when your applications require typed class constants, json_validate(), or readonly property cloning while benefiting from broad ecosystem compatibility. WordPress 6.x, Laravel 11, and Drupal 10 all run well on PHP 8.3 with security support through December 2027. If you need the pipe operator or array_first()/array_last() helpers, consider PHP 8.5. Alternatively, consider PHP 8.4 if you need property hooks or the new HTML5 DOM API, or choose the distro default PHP when you prefer official Debian security team maintenance.

Decide When to Use PHP 8.3

Install PHP 8.3 from the Sury repository when your application requires features unavailable in Debian’s default PHP packages, or when you need the extended security support timeline through December 2027. The Sury repository provides timely updates but operates independently from Debian’s security team, so production deployments should monitor PHP security advisories directly.

Advertisement

Import PHP 8.3 APT Repository on Debian

Update Debian System Before PHP 8.3 Installation

Before adding external repositories, update your existing packages to ensure dependency resolution works correctly. Run the following commands to refresh the package index and apply any pending upgrades:

sudo apt update
sudo apt upgrade

Method 1: Use extrepo (Recommended)

The extrepo tool automates external repository management by handling GPG keys and source file creation. First, install extrepo and its dependencies:

sudo apt install extrepo -y

Next, enable the Sury PHP repository:

sudo extrepo enable sury

The extrepo command creates the repository configuration at /etc/apt/sources.list.d/extrepo_sury.sources and places the GPG key at /var/lib/extrepo/keys/sury.asc. Once enabled, refresh the package index:

sudo apt update

Verify PHP 8.3 is now available from the Sury repository:

apt-cache policy php8.3

Expected output:

php8.3:
  Installed: (none)
  Candidate: 8.3.x+0~YYYYMMDD+debianXX
  Version table:
     8.3.x+0~YYYYMMDD+debianXX 500
        500 https://packages.sury.org/php [codename]/main amd64 Packages

Method 2: Manual Repository Configuration

For scripted deployments or when you need full control over repository configuration, add the Sury repository manually. First, install the required packages:

sudo apt install ca-certificates curl gnupg lsb-release -y

Download and install the Sury PHP repository GPG keyring package:

curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb

Next, create the repository configuration file using the modern DEB822 .sources format:

cat <<EOF | sudo tee /etc/apt/sources.list.d/php.sources
Types: deb
URIs: https://packages.sury.org/php/
Suites: $(lsb_release -cs)
Components: main
Signed-By: /usr/share/keyrings/debsuryorg-archive-keyring.gpg
EOF

Finally, refresh the package index and verify PHP 8.3 availability:

sudo apt update
apt-cache policy php8.3

Expected output:

php8.3:
  Installed: (none)
  Candidate: 8.3.x+0~YYYYMMDD+debianXX
  Version table:
     8.3.x+0~YYYYMMDD+debianXX 500
        500 https://packages.sury.org/php [codename]/main amd64 Packages

3 Install additional PHP versions

You don’t have to install every version listed here, install the ones you need.

3.1 Install PHP 5.6

To install PHP use this command:

apt-get install php5.6 php5.6-cli php5.6-cgi php5.6-fpm php5.6-gd php5.6-mysql php5.6-imap php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php5.6-soap php5.6-opcache libicu65 php5.6-common php5.6-json php5.6-readline php5.6-xml

3.2 Install PHP 7.0

To install PHP use this command:

apt-get install php7.0 php7.0-cli php7.0-cgi php7.0-fpm php7.0-gd php7.0-mysql php7.0-imap php7.0-curl php7.0-intl php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-zip php7.0-mbstring php7.0-soap php7.0-opcache php7.0-common php7.0-json php7.0-readline php7.0-xml

3.3 Install PHP 7.1

To install PHP use this command:

apt-get install php7.1 php7.1-cli php7.1-cgi php7.1-fpm php7.1-gd php7.1-mysql php7.1-imap php7.1-curl php7.1-intl php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl php7.1-zip php7.1-mbstring php7.1-soap php7.1-opcache php7.1-common php7.1-json php7.1-readline php7.1-xml

3.4 Install PHP 7.2

To install PHP use this command:

apt-get install php7.2 php7.2-cli php7.2-cgi php7.2-fpm php7.2-gd php7.2-mysql php7.2-imap php7.2-curl php7.2-intl php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-zip php7.2-mbstring php7.2-soap php7.2-opcache php7.2-common php7.2-json php7.2-readline php7.2-xml

3.5 Install PHP 7.3

To install PHP use this command:

apt-get install php7.3 php7.3-cli php7.3-cgi php7.3-fpm php7.3-gd php7.3-mysql php7.3-imap php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-zip php7.3-mbstring php7.3-soap php7.3-opcache php7.3-common php7.3-json php7.3-readline php7.3-xml

3.6 Install PHP 7.4

To install PHP 7.4 use this command:

apt-get install php7.4 php7.4-cli php7.4-cgi php7.4-fpm php7.4-gd php7.4-mysql php7.4-imap php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-zip php7.4-mbstring php7.4-soap php7.4-opcache php7.4-common php7.4-json php7.4-readline php7.4-xml

3.7 Install PHP 8.0

To install PHP 8.0 use this command:

apt-get install php8.0 php8.0-cli php8.0-cgi php8.0-fpm php8.0-gd php8.0-mysql php8.0-imap php8.0-curl php8.0-intl php8.0-pspell php8.0-sqlite3 php8.0-tidy php8.0-xsl php8.0-zip php8.0-mbstring php8.0-soap php8.0-opcache php8.0-common php8.0-readline php8.0-xml

3.8 Install PHP 8.1

To install PHP 8.1 use this command:

apt-get install php8.1 php8.1-cli php8.1-cgi php8.1-fpm php8.1-gd php8.1-mysql php8.1-imap php8.1-curl php8.1-intl php8.1-pspell php8.1-sqlite3 php8.1-tidy php8.1-xsl php8.1-zip php8.1-mbstring php8.1-soap php8.1-opcache php8.1-common php8.1-readline php8.1-xml

3.9 Install PHP 8.2

To install PHP 8.2 use this command:

apt-get install php8.2 php8.2-cli php8.2-cgi php8.2-fpm php8.2-gd php8.2-mysql php8.2-imap php8.2-curl php8.2-intl php8.2-pspell php8.2-sqlite3 php8.2-tidy php8.2-xsl php8.2-zip php8.2-mbstring php8.2-soap php8.2-opcache php8.2-common php8.2-readline php8.2-xml

3.10 Install PHP 8.3

To install PHP 8.3 use this command:

apt-get install php8.3 php8.3-cli php8.3-cgi php8.3-fpm php8.3-gd php8.3-mysql php8.3-imap php8.3-curl php8.3-intl php8.3-pspell php8.3-sqlite3 php8.3-tidy php8.3-xsl php8.3-zip php8.3-mbstring php8.3-soap php8.3-opcache php8.3-common php8.3-readline php8.3-xml

3.11 Install PHP 8.4

To install PHP 8.4 use this command:

apt-get install php8.4 php8.4-cli php8.4-cgi php8.4-fpm php8.4-gd php8.4-mysql php8.4-imap php8.4-curl php8.4-intl php8.4-pspell php8.4-sqlite3 php8.4-tidy php8.4-xsl php8.4-zip php8.4-mbstring php8.4-soap php8.4-opcache php8.4-common php8.4-readline php8.4-xml

4 Set the OS default PHP back to the correct version

The default PHP of the operating system has to remain at the original version. To fix that, run these commands one by one:

update-alternatives --config php
update-alternatives --config php-cgi
update-alternatives --config php-fpm.sock

On Debian 12, choose 8.2; on Debian 11, choose 7.4; on Debian 10, choose 7.3.

5 Add PHP versions to ISPConfig

In ISPConfig 3, you can configure the new PHP versions under System > Additional PHP Versions > Add new PHP version.

Add the distribution’s default PHP version

First, you have to add a new version for the already installed PHP version. The default version depends on the release you are on:

Debian 10: PHP 7.3
Debian 11: PHP 7.4
Debian 12: PHP 8.2

See below for the configuration for your version.

Configuration for the additional PHP versions

PHP 5.6

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi5.6
Path to the php.ini directory: /etc/php/5.6/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php5.6-fpm
Path to the php.ini directory: /etc/php/5.6/fpm/
Path to the PHP-FPM pool directory: /etc/php/5.6/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php5.6
PHP Jailkit section: php5_6

The cli version for e.g. cron jobs has the name php5.6

PHP 7.0

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.0
Path to the php.ini directory: /etc/php/7.0/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php7.0-fpm
Path to the php.ini directory: /etc/php/7.0/fpm/
Path to the PHP-FPM pool directory: /etc/php/7.0/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php7.0
PHP Jailkit section: php7_0

The cli version for e.g. cron jobs has the name php7.0

PHP 7.1

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.1
Path to the php.ini directory: /etc/php/7.1/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php7.1-fpm
Path to the php.ini directory: /etc/php/7.1/fpm/
Path to the PHP-FPM pool directory: /etc/php/7.1/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php7.1
PHP Jailkit section: php7_1

The cli version for e.g. cron jobs has the name php7.1

PHP 7.2

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.2
Path to the php.ini directory: /etc/php/7.2/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php7.2-fpm
Path to the php.ini directory: /etc/php/7.2/fpm/
Path to the PHP-FPM pool directory: /etc/php/7.2/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php7.2
PHP Jailkit section: php7_2

The cli version for e.g. cron jobs has the name php7.2

PHP 7.3

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.3
Path to the php.ini directory: /etc/php/7.3/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php7.3-fpm
Path to the php.ini directory: /etc/php/7.3/fpm/
Path to the PHP-FPM pool directory: /etc/php/7.3/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php7.3
PHP Jailkit section: php7_3

The cli version for e.g. cron jobs has the name php7.3

PHP 7.4

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.4
Path to the php.ini directory: /etc/php/7.4/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php7.4-fpm
Path to the php.ini directory: /etc/php/7.4/fpm/
Path to the PHP-FPM pool directory: /etc/php/7.4/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php7.4
PHP Jailkit section: php7_4

The cli version for e.g. cron jobs has the name php7.4

PHP 8.0

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi8.0
Path to the php.ini directory: /etc/php/8.0/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php8.0-fpm
Path to the php.ini directory: /etc/php/8.0/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.0/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php8.0
PHP Jailkit section: php8_0

The cli version for e.g. cron jobs has the name php8.0

PHP 8.1

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi8.1
Path to the php.ini directory: /etc/php/8.1/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php8.1-fpm
Path to the php.ini directory: /etc/php/8.1/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.1/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php8.1
PHP Jailkit section: php8_1

The cli version for e.g. cron jobs has the name php8.1

PHP 8.2

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi8.2
Path to the php.ini directory: /etc/php/8.2/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php8.2-fpm
Path to the php.ini directory: /etc/php/8.2/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.2/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php8.2
PHP Jailkit section: php8_2

The cli version for e.g. cron jobs has the name php8.2

PHP 8.3

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi8.3
Path to the php.ini directory: /etc/php/8.3/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php8.3-fpm
Path to the php.ini directory: /etc/php/8.3/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.3/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php8.3
PHP Jailkit section: php8_3

The cli version for e.g. cron jobs has the name php8.3

PHP 8.4

Fast-CGI settings:

Path to the PHP FastCGI binary: /usr/bin/php-cgi8.4
Path to the php.ini directory: /etc/php/8.4/cgi/

PHP-FPM settings:

Path to the PHP-FPM init script: php8.4-fpm
Path to the php.ini directory: /etc/php/8.4/fpm/
Path to the PHP-FPM pool directory: /etc/php/8.4/fpm/pool.d/

PHP-CLI settings:

Path to the PHP CLI binary: /usr/bin/php8.4
PHP Jailkit section: php8_4

The cli version for e.g. cron jobs has the name php8.4

Source:

- A word from our sponsors -

spot_img

Most Popular

More from Author

How To Install ISPConfig 3 on Debian 11

Web hosting panels can also be referred to as control panels....

How to Update ISPConfig 3.3.0p3

The ISPConfig update script is an easy way to update an...

How To Install aaPanel on Ubuntu Ubuntu 22.04.5 LTS

Managing a server can be a daunting task, especially for those...

- A word from our sponsors -

spot_img

Read Now

How To Install ISPConfig 3 on Debian 11

Web hosting panels can also be referred to as control panels. They allow users to manage various servers and hosted services. They provide several features and advantages that include one-click deployment, automated health alerts, mail server support, domain management, backup and security tasks. There are several Web...

How to Update ISPConfig 3.3.0p3

The ISPConfig update script is an easy way to update an ISPConfig 3 installation. If you want to make a manual backup of ISPConfig, see the instructions at the end of the article. This tutorial applies to ISPConfig 3.2, ISPConfig 3.3, and also ISPConfig 3.3.0p3 To update ISPConfig...

Solution for “The repository ‘http://download.proxmox.com/debian/pbs-client trixie InRelease’ is not signed” error

I've solved this error with PBS Client in Debian 13 (Trixie): Code: arning: OpenPGP signature verification failed: http://download.proxmox.com/debian/pbs-client trixie InRelease: Sub-process /usr/bin/sqv returned an error code (1), error message is: Missing key 24B30F06ECC1836A4E5EFECBA7BCD1420BFE778E, which is needed to verify signature. This way:First, update the repo /etc/apt/sources.list.d/pbs-client.list (or whatever your repo is...

How To Install aaPanel on Ubuntu Ubuntu 22.04.5 LTS

Managing a server can be a daunting task, especially for those who are not well-versed in command-line interfaces. Fortunately, control panels like aaPanel simplify this process significantly. This article provides a comprehensive guide on how to install aaPanel on Ubuntu 24.04 LTS, ensuring you have a powerful...

How To Install Fail2Ban on Ubuntu 24.04.2 LTS

Introduction Any service that is exposed to the Internet is at risk of malware attacks. For example, if you are running a service on a publicly available network, attackers can use brute-force attempts to sign in to your account. Fail2ban is a tool that helps protect your Linux machine...

How to Install Webmin on Debian 12

Introduction Are you searching for a step-by-step guide to install Webmin on Debian 12? This simple tutorial is for you! Webmin is a free, open-source web-based control panel that simplifies Linux server management right from your browser. Its intuitive dashboard lets you handle various configurations, including user accounts, disk...

How To Install ISPConfig Control Panel on Ubuntu 22.04

The main task of a Linux system administrator revolves around monitoring the Linux system hardware and software, performing installations and upgrades while maintaining all the essential services and applications. In many scenarios, these activities are executed via the command line. This is mainly because the command line(server...

Installing Let’s Encrypt Free SSL Certificate on iRedMail

In our previous guides, we saw how one can install and configure iRedMail Server. The default installation of iRedMail generates and install a self-signed SSL certificate for Mails services – POP3/IMAP/SMTP over TLS and for HTTPS access to webmail services. When using a self-signed certificate, you’ll often get...

APT sources.list entries for every Debian release

/etc/apt/sources.list entries for every Debian release since Wheezy, including archived releases Debian uses APT as package installation and update manager. This also applies to a distribution (release) upgrade. Usually not much changes in the APT configuration, except the code name. But sometimes, the /etc/apt/sources.list file needs some adjustments...

Debian / Ubuntu Linux restart network interface

In this article, we will see How to restart Network Interface in Debian and Ubuntu. We can restart the networking service in Linux using various command. Use the following commands as per your Linux distribution to restart the networking service. You must run the command as root...

Install iRedMail on Debian 12

What is iRedMail? iRedMail is a shell script that automatically installs and configures all necessary mail server components on your Linux/BSD server, thus eliminating manual installation and configuration. With iRedMail, you can easily create unlimited mailboxes and unlimited mail domains in a web-based admin panel. Mailboxes can be...

VirtualBox : Advanced Features and Practical Use

When using a traditional you need to install the operating system on a physical machine for evaluating software that cannot be installed on your current operating system. Oracle VirtualBox is what you need in this case, instead of reinstalling software on your physical machine. VirtualBox is designed...