How to Enable the PHP SOAP Extension on Debian 13, 12 and Ubuntu

Quick Summary
- Install the SOAP package for the PHP version your site runs: php8.4-soap on Debian 13, php8.2-soap on Debian 12, php8.3-soap on Ubuntu 24.04 or php8.5-soap on Ubuntu 26.04 (php-soap picks the release's default).
- The package enables SOAP for the command line, PHP-FPM and Apache and restarts PHP-FPM; if it was disabled earlier, run sudo phpenmod soap and restart phpX.Y-fpm or apache2 yourself.
- Check with php -m | grep -i soap or php --ri soap, and with a temporary extension_loaded('soap') file for the web server, since the two can load different configurations.
Some PHP applications and WordPress plugins need the PHP SOAP extension to talk to SOAP web services. Without it, their code stops with Uncaught Error: Class "SoapClient" not found. To add it on Debian or Ubuntu, install the SOAP package for the PHP version your site runs: sudo apt install php-soap for the PHP version the release ships, or the versioned package, such as php8.5-soap, for another version. The package turns the extension on and restarts PHP-FPM; then check it with php -m. Run the commands over SSH as a user with sudo rights.
Which SOAP package do you need?
Each release ships one PHP version, and php-soap installs the SOAP package for that version:
- Debian 13 (trixie): PHP 8.4, package
php8.4-soap - Debian 12 (bookworm): PHP 8.2, package
php8.2-soap - Ubuntu 26.04 LTS: PHP 8.5, package
php8.5-soap - Ubuntu 24.04 LTS: PHP 8.3, package
php8.3-soap - Ubuntu 22.04 LTS: PHP 8.1, package
php8.1-soap
You can look these up on packages.debian.org and Launchpad. To see which PHP your server has, run:
php -v
apt list --installed 'php*'The second command lists the installed PHP packages, for example php8.4-fpm or libapache2-mod-php8.4, so you can tell which version the web server uses. If you installed another PHP version from Ondřej Surý’s repository, for example PHP 8.5 on Debian 13, install the versioned package for it, such as php8.5-soap. With that repository added, the unversioned php-soap installs the repository’s default instead, currently php8.4-soap on both Debian 12 and 13, so always name the version you need. Installing PHP 8.4 or 8.5 on Debian explains the setup.
Step 1: install the extension
sudo apt update
sudo apt install php8.4-soapReplace 8.4 with your version, or install php-soap to get the package for the release’s default PHP. On Ubuntu the SOAP packages are in the universe component. If apt says it can’t find the package, enable universe with sudo add-apt-repository universe and run sudo apt update again.
Step 2: make sure it’s enabled, then restart
The package places soap.ini in /etc/php/8.4/mods-available/ and enables it for every way of running PHP: the command line, PHP-FPM and Apache’s mod_php. A package trigger then restarts PHP-FPM, and Apache when it runs mod_php, so in most cases SOAP works right after the install.
It stays off if someone disabled it earlier with phpdismod soap: the package respects that choice. Enable it yourself, then restart the service your site uses, because phpenmod doesn’t restart anything:
sudo phpenmod soap
sudo systemctl restart php8.4-fpmWithout options, phpenmod enables the module for every installed PHP version and every SAPI; add -v 8.4 to limit it to one version. If your site uses Apache with mod_php, restart Apache instead: sudo systemctl restart apache2.
Step 3: check that SOAP is loaded
php -m | grep -i soap
php --ri soapThe first command prints soap when the command-line PHP loads the extension, and nothing when it doesn’t. The second prints the extension’s details, starting with Soap Client => enabled and Soap Server => enabled, or Extension 'soap' not present. if it’s missing.
These commands check the command-line PHP. The web server’s PHP reads its own configuration folder, so check it too. Put a temporary file in your web root, for example /var/www/html/soap-check.php, open it in the browser and delete it afterwards:
<?php
echo extension_loaded( 'soap' ) ? 'SOAP is loaded' : 'SOAP is missing';If the command line has SOAP but the website doesn’t, the site runs another PHP version or the service wasn’t restarted. Finding the php.ini each one loads shows how to tell which PHP the website uses.
Older Debian releases (9, 10 and 11)
On Debian 9, 10 and 11 the same php-soap command installs SOAP for PHP 7.0, 7.3 or 7.4, but those releases are past the end of their long-term support and their PHP no longer gets security fixes from Debian; Debian 9 and 10 packages have also moved to archive.debian.org, so apt update fails there. Upgrade the server to Debian 12 or 13 instead.
Related articles
- installing PHP 8.4 or 8.5 on Debian 13 and 12: the PHP-FPM and Apache setup this extension plugs into
- adding the Memcached PHP extension on Debian: the same apt and restart pattern for another extension
- fixing apt’s HTTPS method driver error: if apt-get update fails on an older server

