laravel composer update : the requested PHP extension dom is missing from your system

laravel composer update : the requested PHP extension dom is missing from your system

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

Stefan Bogdanescu

Founder & Senior Architect

Laravel Composer Update : The Requested PHP Extension DOM Is Missing From Your System

When you execute composer update in a Laravel project, you expect Composer to reconcile your dependencies and ensure the codebase remains current. However, encountering the error "the requested PHP extension dom is missing from your system" halts this process immediately. This specific message often appears when running on Ubuntu 16.04 with an older stack like Laravel 5.2, creating a confusing situation where the extension seems to be present but Composer refuses to use it.

The core issue usually stems from a discrepancy between what the operating system reports as installed and how PHP actually loads extensions at runtime. On Ubuntu 16.04, the php-dom package is indeed available in the repositories, but simply installing the package does not guarantee that the extension is active within the specific PHP binary you are invoking.

To resolve this, you must first verify which PHP executable Composer is targeting. Run the following command to inspect the current environment:

php -m | grep dom

If this returns no output or simply confirms the package name without loading the module, the extension is likely not enabled in your configuration file (php.ini), even though the binary exists. Alternatively, you might be invoking a different PHP version than the one where dom is installed. For instance, Ubuntu 16.04 often ships with PHP 5.6 or 7.0 by default, but if you have compiled a custom PHP version for CLI usage, Composer will use that one.

If the extension is not listed in the output of php -m, check your php.ini file located in the same directory as the binary or in /etc/php/.... Ensure that the line extension=dom is uncommented (remove the leading semicolon). After making this change, restart any web servers if they are configured to use PHP directly, though CLI commands usually pick up changes immediately.

Sometimes the problem persists because Composer itself was installed using a specific PHP version that lacks the extension. If you installed Composer via the official installer script or a direct download, it might be pointing to /usr/bin/php while your php.ini modifications were made for a different path like /usr/bin/php7.0. To align these, ensure that composer.phar or your global composer executable is using the same PHP binary as your Laravel application. You can force Composer to use a specific version by setting an environment variable:

export COMPOSER_HOME=/path/to/composer
export PATH=/usr/bin/php7.0:$PATH

Another common pitfall involves the composer.lock file. If you recently updated PHP or enabled the DOM extension, but your composer.lock still references a version of a package that explicitly requires DOM in a way that conflicts with your current setup, Composer might throw this error during dependency resolution. Try clearing the cache and running the update again:

rm composer.lock
composer clear-cache
composer update

In environments where you cannot modify the system PHP installation—such as shared hosting or constrained containers—you may need to build a local Docker container with the correct PHP extensions pre-installed. This ensures isolation and prevents conflicts between system packages and application requirements.

While this error is common on legacy stacks like Ubuntu 16.04, it highlights the importance of verifying the runtime environment before assuming an extension is functional. If you are maintaining older Laravel versions (like 5.2) on modern systems, consider whether upgrading PHP and Composer versions is feasible, as newer major versions often drop support for extensions in end-of-life PHP releases. For more guidance on managing legacy Laravel projects with modern tooling, resources like https://laravelcompany.com can provide insights into migration strategies or compatibility layers.

Our network