require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension

require ext-xml * -> it is missing from your system. Install or enable PHP's xml extension

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

require ext-xml * -> it is missing from your system

When running composer update on a Laravel project, you might encounter an error stating that the ext-xml extension is missing. The message specifically points out that phpunit/phpunit requires this extension to function correctly. This situation often confuses developers because they may have already installed packages like php7.4-xml or php-xml via their system package manager, yet PHP still reports the extension as unavailable.

The core issue here is a mismatch between what your operating system thinks is installed and what the PHP interpreter actually sees when running in CLI mode. Your output shows that you are using PHP 7.4.22 on a Debian-based or Ubuntu-like system (indicated by apt). The error log explicitly lists several .ini files that PHP checks for extensions, starting with /etc/php/7.4/cli/php.ini.

The fact that php -m lists modules like dom, libxml, and json but does not list xml might seem contradictory at first glance. However, in the context of PHPUnit's dependency resolution, the specific module name matters. The error message require ext-xml * is looking for a specific extension entry point. In many standard PHP installations on Linux, the php-xml package provides the core XML functions and classes (SimpleXML, DOM, etc.) which are loaded under the umbrella of the xml extension or directly via the modules listed in your php -m output.

The crucial detail is that Composer checks for the existence of the extension using a specific function name or file presence check. If the package php-xml was installed but the extension wasn't explicitly enabled in the configuration, or if the installation didn't match the version of PHP CLI you are running, the check fails.

To resolve this without guessing which line to add, follow these steps:

  1. Verify the exact location: Run php --ini. Based on your output, PHP is looking at /etc/php/7.4/cli/php.ini and files in /etc/php/7.4/cli/conf.d/.
  2. Check existing configuration: Look inside those .ini files for a line that says extension=xml.so or extension=dom.so. Sometimes the modules are compiled directly into PHP (static linking), but on Debian/Ubuntu, they usually require the .so file to be loaded.
  3. Enable the extension: If you find a commented-out line like ;extension=xml, remove the semicolon and the comment marks. Alternatively, if the file is missing entirely in the conf.d directory, you can add it manually.

However, on systems managed by apt, the most reliable method is often to ensure the package dependencies are resolved correctly before touching .ini files. The error message suggests that simply installing php-xml might not have linked the correct shared object file for your specific PHP build.

If editing .ini files feels risky or if you cannot locate the exact line, try reinstalling the specific CLI package to ensure the extension files are present and linked correctly:

sudo apt-get install --reinstall php7.4-xml php7.4-cli

After this command completes, restart your PHP service (if running as a daemon) or simply open a new terminal session. Then, run composer update again. Composer will re-evaluate the dependency graph and should successfully resolve the PHPUnit requirement if the ext-xml function is now available to the CLI interpreter.

Remember that different environments might handle extensions differently. In Docker containers or shared hosting, you often cannot install system packages like php7.4-xml; instead, you must enable the extension within the container's PHP configuration or use a base image that has it pre-installed. For local development on Linux, ensuring the correct .so file is loaded in the cli SAPI configuration is the standard fix.

Our network