How to Install PHP 8.3 on Debian 13, 12 and 11

Install PHP 8.3 on Debian 13, 12, or 11 with the Sury APT repository. Covers Apache, Nginx, extensions, updates, and removal.

Last updatedAuthorJoshua JamesRead time9 minGuide typeDebian

Debian’s default PHP package does not stay fixed across releases, so application compatibility often decides whether PHP 8.3 is worth pinning. To install PHP 8.3 on Debian, you add Ondrej Sury’s PHP repository because Debian 13 (Trixie) already ships PHP 8.4, Debian 12 (Bookworm) ships PHP 8.2, and Debian 11 (Bullseye) ships PHP 7.4 from its default APT sources.

The manual DEB822 workflow adds the current Sury repository, then walks through Apache mod_php, Apache with PHP-FPM, and Nginx with PHP-FPM. It also covers version-specific extension packages such as php8.3-redis, switching the default CLI binary with update-alternatives, fixing older extrepo conflicts, and removing PHP 8.3 cleanly when you no longer need it.

Install PHP 8.3 on Debian

These steps support Debian 13 (Trixie), Debian 12 (Bookworm), and Debian 11 (Bullseye). PHP 8.3 comes from the same Sury repository on all three releases, so the repository setup stays consistent even though Debian’s default PHP version differs.

MethodBest UsePackagesNotes
Apache with mod_phpSmall Apache sites that need the shortest setupapache2, php8.3, libapache2-mod-php8.3Simple to deploy, but Apache and PHP share the same process model
Apache with PHP-FPMApache sites that need better process isolationapache2, php8.3, php8.3-fpmUses Apache proxy_fcgi, not mod_fcgid
Nginx with PHP-FPMNginx stacks, reverse proxies, and higher-traffic PHP sitesnginx, php8.3, php8.3-fpm, php8.3-cliRequires a server-block change for the PHP-FPM socket
  • Choose Apache with mod_php when you want the simplest working PHP setup on Apache.
  • Choose Apache with PHP-FPM when you already run Apache but want cleaner PHP worker separation.
  • Choose Nginx with PHP-FPM when your stack already uses Nginx or you want the usual Nginx + FPM layout from the start.

Run only one web server on the same IP address and port unless you have deliberately changed the listeners. If Nginx already owns port 80 for the site, use the Nginx PHP-FPM path or move Apache to another listener before restarting it.

If you previously enabled the Sury repository with extrepo, do not keep that source alongside the manual DEB822 method used here. Debian can stop apt update with a Signed-By conflict when both methods point to the same repository. If that error already appeared, use the cleanup steps in Fix Signed-By Conflicts from a Previous extrepo Setup on Debian.

Step 1: Update Debian and Install PHP 8.3 Prerequisites

Refresh the package index first, then install the small prerequisite set the repository setup actually needs. Desktop installs often already have ca-certificates, but minimal and cloud images may not, and curl is not guaranteed either. For more detail on HTTPS downloads and flags, see our curl command guide.

sudo apt update
sudo apt install ca-certificates curl -y

These commands use sudo for tasks that need root privileges. If your user is not in the sudoers file yet, add a user to sudoers on Debian before continuing.

Step 2: Add the Sury PHP Repository on Debian

Sury distributes a small keyring package, which is the easiest way to place the repository signing key in /usr/share/keyrings/ without using deprecated apt-key workflows. Download the package, then let APT install it locally:

curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
sudo apt install /tmp/debsuryorg-archive-keyring.deb -y

Create the DEB822 repository file next. The printf | sudo tee pattern writes the root-owned .sources file directly, while a plain shell redirection would still run as your regular user and fail on that path.

printf '%s\n' \
    "Types: deb" \
    "URIs: https://packages.sury.org/php/" \
    "Suites: $(. /etc/os-release && echo "${VERSION_CODENAME}")" \
    "Components: main" \
    "Signed-By: /usr/share/keyrings/debsuryorg-archive-keyring.gpg" | sudo tee /etc/apt/sources.list.d/php.sources > /dev/null

Refresh APT, then confirm Debian can see the PHP 8.3 packages from Sury.

sudo apt update
apt-cache policy php8.3

On Debian 13 (Trixie), the output looks like this:

Hit:1 http://security.debian.org/debian-security trixie-security InRelease
Hit:2 http://deb.debian.org/debian trixie InRelease
Hit:3 http://deb.debian.org/debian trixie-updates InRelease
Get:4 https://packages.sury.org/php trixie InRelease [6,126 B]
Get:5 https://packages.sury.org/php trixie/main amd64 Packages [275 kB]

php8.3:
  Installed: (none)
  Candidate: 8.3.31-3+0~20260514.82+debian13~1.gbp7c4146
  Version table:
     8.3.31-3+0~20260514.82+debian13~1.gbp7c4146 500
        500 https://packages.sury.org/php trixie/main amd64 Packages

Debian 12 and Debian 11 show the same repository with bookworm or bullseye instead of trixie. The package revision changes over time, so the exact version string in your output will reflect the current Sury build for your release.

Step 3: Install PHP 8.3 with Apache mod_php on Debian

Use this path when Apache is your web server and you want the fewest moving parts. If Apache is not installed yet, start with Install Apache on Debian, then add the PHP module.

sudo apt install apache2 php8.3 libapache2-mod-php8.3 -y
sudo systemctl restart apache2

Verify Apache actually loaded the PHP module. The grep -E filter catches both generic and versioned module names while keeping the module list short; if you want more matching patterns, see our grep command guide.

sudo apache2ctl -M | grep -E 'php[0-9]*_module'
php_module (shared)

Step 4: Install PHP 8.3 with Apache and PHP-FPM on Debian

Choose Apache with PHP-FPM when you want Apache to pass PHP requests to a separate FastCGI worker pool instead of loading PHP directly into each Apache worker.

sudo apt install apache2 php8.3 php8.3-fpm -y

If you previously enabled libapache2-mod-php8.3, disable the Apache PHP module before switching Apache to PHP-FPM. Keeping both handlers active at the same time leads to confusing request routing.

if sudo a2query -m php8.3 > /dev/null 2>&1; then
    sudo a2dismod php8.3
fi
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.3-fpm
sudo apache2ctl configtest
sudo systemctl restart apache2

Check the PHP-FPM service state after enabling the Apache configuration.

sudo systemctl status php8.3-fpm --no-pager
php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.3-fpm.service; enabled; preset: enabled)
     Active: active (running)

Step 5: Install PHP 8.3 with Nginx and PHP-FPM on Debian

Nginx always uses PHP-FPM for PHP execution. If you still need the web server itself, install it first with Install Nginx on Debian, then add these PHP packages.

sudo apt install nginx php8.3 php8.3-fpm php8.3-cli -y
sudo systemctl enable php8.3-fpm --now

Add the PHP location block to the Nginx server block that should process PHP files. For a fuller server-block walkthrough, use the separate Nginx PHP-FPM configuration guide.

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}

Validate the Nginx configuration before reloading the service so you catch typos before they interrupt live traffic.

sudo nginx -t
sudo systemctl reload nginx
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Confirm the PHP-FPM service is running and that the expected socket exists for Nginx.

sudo systemctl status php8.3-fpm --no-pager
ls -l /run/php/php8.3-fpm.sock
php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.3-fpm.service; enabled; vendor preset: enabled)
     Active: active (running)

srw-rw---- 1 www-data www-data 0 May 22 11:14 /run/php/php8.3-fpm.sock

Step 6: Verify PHP 8.3 on Debian

Finish with a CLI version check so you can confirm the PHP 8.3 binary is available system-wide.

php --version
PHP 8.3.31 (cli) (built: May 14 2026 15:45:35) (NTS)
Copyright (c) The PHP Group

Install PHP 8.3 Extensions on Debian

Install Common PHP 8.3 Extensions on Debian

Use version-specific package names when you want the extension tied to PHP 8.3 itself. Packages such as php8.3-redis, php8.3-xmlrpc, and php8.3-imagick follow the Sury PHP 8.3 branch directly, while unversioned names like php-redis follow Debian’s default PHP branch instead.

sudo apt install php8.3-curl php8.3-mysql php8.3-gd php8.3-opcache php8.3-zip php8.3-intl php8.3-bcmath php8.3-imagick php8.3-xmlrpc php8.3-readline php8.3-memcached php8.3-redis php8.3-mbstring php8.3-apcu php8.3-xml php8.3-soap -y

JSON support is built into modern PHP releases, so there is no separate php8.3-json package. The php8.3-xml package also provides DOM, SimpleXML, XMLReader, and XMLWriter support.

Reference the Most Common PHP 8.3 Extension Packages on Debian

  • php8.3-mysql adds MySQL and MariaDB connectivity for PHP applications. Pair it with Install MariaDB on Debian when you need a local database server.
  • php8.3-imagick adds advanced image processing support through ImageMagick. The dedicated setup is covered in Install PHP Imagick on Debian.
  • php8.3-redis and php8.3-memcached add object-cache and session-cache backends. Use them with Install Redis on Debian or Install Memcached on Debian.
  • php8.3-xmlrpc provides XML-RPC support for older integrations that still depend on it. Newer applications should prefer REST APIs when they are available.
  • php8.3-opcache, php8.3-apcu, and php8.3-bcmath are common performance and application-support modules for WordPress, Laravel, Drupal, and other modern PHP stacks.

Browse the full package list from the repository by searching for the php8.3- prefix directly. The output is long, but a shortened Debian 13 example starts like this:

apt search php8.3-
Sorting...
Full Text Search...
php8.3-amqp/trixie 2.1.2-7+0~20260519.35+debian13~1.gbpff72ce amd64
  AMQP extension for PHP

php8.3-apcu/trixie 5.1.28-1+0~20260518.58+debian13~1.gbp5969fc amd64
  APC User Cache for PHP

php8.3-bcmath/trixie 8.3.31-3+0~20260514.82+debian13~1.gbp7c4146 amd64
  Bcmath module for PHP

List Installed PHP 8.3 Extensions on Debian

Check the active module list after installing extensions. If you only need to confirm one module quickly, filter the output with grep for the module name you care about.

php8.3 -m
[PHP Modules]
calendar
Core
ctype
curl
date
filter
gd
intl
json
mbstring
mysqli
PDO
pdo_mysql
redis
soap
xml
Zend OPcache
zip

[Zend Modules]
Zend OPcache

Install PHP 8.3 Development Packages on Debian

Install the development headers and lightweight code-coverage tools only when you actually compile extensions or build PHP packages locally.

sudo apt install php8.3-dev php8.3-pcov -y

Run PHP 8.3 Alongside Other PHP Versions on Debian

Manage Multiple PHP Versions on Debian

Sury packages are coinstallable, so PHP 8.3 can live next to PHP 8.2, PHP 8.4, or older branches on the same host. Each CLI package installs its own binary, such as /usr/bin/php8.3, while the generic /usr/bin/php symlink is controlled through Debian’s alternatives system.

This matters most on shared servers and deployment boxes where one project still expects PHP 8.2 while another must stay on PHP 8.3. Changing the CLI default does not automatically change which socket or handler Apache and Nginx use, so keep your web-server configuration and your CLI selection in sync.

Set the Default PHP CLI Version on Debian

Use update-alternatives when more than one PHP CLI branch is installed and you want the plain php command to point at a different version.

sudo update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php8.3   83        auto mode
  1            /usr/bin/php8.2   82        manual mode
  2            /usr/bin/php8.3   83        manual mode

Set PHP 8.3 directly when you do not want the interactive prompt.

sudo update-alternatives --set php /usr/bin/php8.3

Compare PHP 8.3 with Debian’s Default PHP Versions

On Debian 13, installing PHP 8.3 is a version-pinning choice because Debian already ships PHP 8.4 by default. On Debian 12 and Debian 11, it is both a newer-feature install and a compatibility choice for applications that no longer target PHP 7.4 or want to stay on the 8.3 branch instead of 8.2.

Debian ReleaseDefault PHP from Debian APTWhy PHP 8.3 May Still HelpWhen the Default Package Is Fine
Debian 13 (Trixie)PHP 8.4Your application needs PHP 8.3 specifically, or you want the same PHP branch across several serversYou prefer Debian-maintained packages and your application already supports PHP 8.4
Debian 12 (Bookworm)PHP 8.2You need PHP 8.3 features or want newer branch parity with upstream hosting targetsYour stack already supports PHP 8.2 and you want to stay in Debian’s default repositories
Debian 11 (Bullseye)PHP 7.4You need a current PHP 8.x branch without leaving Bullseye immediatelyYou are maintaining a legacy application that still depends on PHP 7.4

If PHP 8.3 is not the right fit, you can instead install the default PHP version on Debian, install PHP 8.2 on Debian, install PHP 8.4 on Debian, or install PHP 8.5 on Debian.

Update PHP 8.3 on Debian

Sury packages update through APT while the repository remains enabled. A normal package upgrade pulls newer PHP 8.3 builds together with any security fixes for installed extension packages.

sudo apt update
sudo apt upgrade

For a narrower PHP-only update, upgrade the shared PHP 8.3 packages first.

sudo apt install --only-upgrade php8.3 php8.3-cli php8.3-common

Update the handler package that matches your web server. Use php8.3-fpm for Nginx or Apache with PHP-FPM.

sudo apt install --only-upgrade php8.3-fpm

Use the Apache module package only when you installed the mod_php method.

sudo apt install --only-upgrade libapache2-mod-php8.3

Troubleshoot PHP 8.3 on Debian

Fix a PHP-FPM Socket Not Found Error on Debian

If Nginx returns a 502 error, check the newest Nginx log entries first. The tail command is ideal for this kind of log check; our tail command guide covers more real-time log-monitoring patterns.

sudo tail -20 /var/log/nginx/error.log

A missing socket usually looks like this:

connect() to unix:/run/php/php8.3-fpm.sock failed (2: No such file or directory)

Restart PHP-FPM, then confirm both the service state and the socket path.

sudo systemctl restart php8.3-fpm
sudo systemctl status php8.3-fpm --no-pager
ls -l /run/php/php8.3-fpm.sock
php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.3-fpm.service; enabled)
     Active: active (running)

srw-rw---- 1 www-data www-data 0 May 22 11:14 /run/php/php8.3-fpm.sock

Fix the Wrong PHP Version Being Active on Debian

When php --version shows the wrong branch, query the alternatives database to see which PHP binary currently owns /usr/bin/php.

update-alternatives --query php
Name: php
Link: /usr/bin/php
Status: auto
Best: /usr/bin/php8.3
Value: /usr/bin/php8.2

Alternative: /usr/bin/php8.2
Priority: 82

Alternative: /usr/bin/php8.3
Priority: 83

In that example, PHP 8.3 is available but the link still points at PHP 8.2. Switch the CLI default, then verify the result.

sudo update-alternatives --set php /usr/bin/php8.3
php --version
PHP 8.3.31 (cli) (built: May 14 2026 15:45:35) (NTS)
Copyright (c) The PHP Group

Remember that Apache and Nginx do not follow the CLI symlink automatically. If your web server still points at an older FPM socket or Apache module, update that configuration separately.

Fix PHP 8.3 Extension Loading Problems on Debian

Start by confirming the package is installed, then check whether PHP 8.3 is actually loading the module. The filtered module check uses grep to keep the output short.

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package} ${Version}\n' php8.3-redis
php8.3 -m | grep -Fx redis
ii  php8.3-redis 6.3.0-2+0~20251204.66+debian13~1.gbpd148c3
redis

If the package is installed but the module still does not load, reinstall the extension and restart PHP-FPM so the new module list is applied.

sudo apt install --reinstall php8.3-redis -y
sudo systemctl restart php8.3-fpm

For deeper errors, inspect the PHP-FPM log after the restart.

sudo tail -50 /var/log/php8.3-fpm.log

Fix Signed-By Conflicts from a Previous extrepo Setup on Debian

If apt update complains about conflicting Signed-By values, you almost always have both the manual Sury source and an older extrepo source configured at the same time.

sudo apt update
E: Conflicting values set for option Signed-By regarding source https://packages.sury.org/php/ bookworm: /var/lib/extrepo/keys/sury.asc != /usr/share/keyrings/debsuryorg-archive-keyring.gpg
E: The list of sources could not be read.

Keep the manual DEB822 method, then remove the older extrepo file and key. If you still use extrepo for other repositories, managing third-party APT repositories on Debian with extrepo covers the broader workflow.

sudo extrepo disable sury
sudo rm -f /etc/apt/sources.list.d/extrepo_sury.sources /var/lib/extrepo/keys/sury.asc
sudo apt update

Verify that only the manual Sury source remains.

grep -R "packages.sury.org/php" /etc/apt/sources.list /etc/apt/sources.list.d 2> /dev/null
/etc/apt/sources.list.d/php.sources:URIs: https://packages.sury.org/php/

Remove PHP 8.3 from Debian

Remove PHP 8.3 Packages from Debian

The quoted package pattern removes the PHP 8.3 core packages and any installed php8.3-* extensions without relying on shell filename expansion. The Apache module package has a different name, so include it explicitly when you used the mod_php method.

Review APT’s removal list before confirming the command on production hosts. The PHP packages are safe to remove, but you may still want to keep Apache, Nginx, or database services in place if other sites depend on them.

sudo apt remove --purge 'php8.3*' libapache2-mod-php8.3
sudo apt autoremove

Remove the Sury Repository from Debian

Remove the Sury repository only when no other Sury-managed PHP branch or extension still needs it. Check installed PHP packages against the enabled Sury source before deleting the repository file.

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 'php*' 'libapache2-mod-php*' 2> /dev/null | awk '$1 ~ /^ii/ {print $2}' | while read -r package; do
    if apt-cache policy "$package" | grep -q "packages.sury.org/php"; then
        printf '%s\n' "$package"
    fi
done

No output means the installed PHP packages checked do not show Sury as an available source in APT policy. If the command lists packages you still use, keep the repository enabled or migrate those packages before removing the source.

Delete the manual repository file, then remove the Sury keyring package so Debian stops trusting that source.

sudo rm -f /etc/apt/sources.list.d/php.sources
sudo apt remove --purge debsuryorg-archive-keyring
sudo apt update

If you also migrated away from an older extrepo setup, remove those leftover files too.

sudo rm -f /etc/apt/sources.list.d/extrepo_sury.sources /var/lib/extrepo/keys/sury.asc

Verify PHP 8.3 Removal on Debian

Confirm the repository entry is gone and that no PHP 8.3 packages remain installed.

grep -R "packages.sury.org/php" /etc/apt/sources.list /etc/apt/sources.list.d 2> /dev/null || echo "No Sury repository entries found"
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 'php8.3*' libapache2-mod-php8.3 debsuryorg-archive-keyring 2> /dev/null | grep -E '^(ii|rc)' || echo "No PHP 8.3 or Sury keyring package state remains"
No Sury repository entries found
No PHP 8.3 or Sury keyring package state remains

Conclusion

PHP 8.3 is now available on Debian with version-specific extensions, PHP-FPM support, and a clean path for switching the default CLI binary. For the next step, install Composer on Debian, then secure Apache with Let’s Encrypt on Debian or secure Nginx with Let’s Encrypt on Debian before serving PHP applications publicly.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: