How to Install PHP 8.3 on Debian (13, 12, 11)

Last updated Saturday, March 14, 2026 8:44 am 13 min read

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-fpm, libapache2-mod-fcgidDisable mod_php first if you already enabled it
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.

If you previously enabled the Sury repository with extrepo, do not keep that source alongside the manual DEB822 method in this article. 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. If you want a broader refresher 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, follow this guide to add a user to sudoers on Debian.

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.x+0~YYYYMMDD+debian13~1.gbp...
  Version table:
     8.3.x+0~YYYYMMDD+debian13~1.gbp... 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 8.3.x 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 filter keeps the module list short; if you want more matching patterns, see our grep command guide.

sudo apache2ctl -M | grep php_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 libapache2-mod-fcgid -y

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

sudo a2dismod php8.3
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.3-fpm
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 the PHP packages below.

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.

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 Mar 14 08: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.x (cli) (built: ...)
Copyright (c) The PHP Group
Zend Engine v4.3.x, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.x, Copyright (c), by Zend Technologies

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.

apt search php8.3-
Sorting...
Full Text Search...
php8.3-amqp/trixie 2.x.x amd64
  AMQP extension for PHP

php8.3-apcu/trixie 5.x.x amd64
  APC User Cache for PHP

php8.3-bcmath/trixie 8.3.x 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.4 on Debian, or install PHP 8.5 on Debian.

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 Mar 14 08: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.x (cli) (built: ...)
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 below uses grep to keep the output short.

dpkg -l php8.3-redis | grep '^ii'
php8.3 -m | grep -Fx redis
ii  php8.3-redis  6.x.x+0~...  amd64  PHP extension for interfacing with Redis
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.

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 from this article, then remove the older extrepo file and key. If you still use extrepo for other repositories, this guide on 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.

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*' -y
sudo apt autoremove -y

Remove the Sury Repository from Debian

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 -y
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 -l 'php8.3*' 2>/dev/null | grep '^ii' || echo "No installed PHP 8.3 packages found"
No Sury repository entries found
No installed PHP 8.3 packages found

PHP 8.3 on Debian FAQ

Is PHP 8.3 available in Debian’s default repositories?

No. Debian 13 (Trixie) ships PHP 8.4 by default, Debian 12 (Bookworm) ships PHP 8.2, and Debian 11 (Bullseye) ships PHP 7.4. To install PHP 8.3 on any of those releases, add the Sury PHP repository first.

Which package installs Redis support for PHP 8.3 on Debian?

Use php8.3-redis when you want the Redis extension built for PHP 8.3 specifically. The unversioned php-redis package follows Debian’s default PHP branch instead, which can point at PHP 8.4 on Debian 13 or PHP 8.2 on Debian 12.

Can PHP 8.3 run alongside Debian’s default PHP version?

Yes. Sury packages are coinstallable, so you can keep /usr/bin/php8.3 next to other PHP branches and switch the default CLI binary with update-alternatives when needed. Apache and Nginx still need their own PHP handler or socket configured separately.

How do I update PHP 8.3 later on Debian?

Once the Sury repository is installed, PHP 8.3 updates arrive through normal APT package management. A regular sudo apt update followed by sudo apt upgrade will pull newer PHP 8.3 builds, or you can use sudo apt install --only-upgrade php8.3 php8.3-cli php8.3-common php8.3-fpm for a narrower update path.

Why does apt update show a Signed-By conflict after enabling the Sury repository?

That error usually means the Sury repository was configured twice, once with the manual DEB822 file from this article and once with an older extrepo source. Remove the extrepo file and key under /etc/apt/sources.list.d/ and /var/lib/extrepo/keys/, then keep only the manual php.sources entry.

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.

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 coffee Buy 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:

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

Leave a Comment

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

Let us know you are human: