"The requested PHP extension bcmath is missing from your system."

"The requested PHP extension bcmath is missing from your system."

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

Stefan Bogdanescu

Founder & Senior Architect

The requested PHP extension bcmath is missing from your system

You are staring at a composer require output that explicitly states: the requested PHP extension bcmath is missing from your system. This isn't a bug in Composer, nor is it a configuration error in your php.ini. It is a hard requirement mismatch between the package you want to install and the runtime environment of your PHP interpreter.

The php-amqplib/php-amqplib library, specifically version 2.6.x, depends on ext-bcmath. This extension provides functions for arbitrary-precision arithmetic. While it might seem like a niche mathematical tool, many high-performance libraries rely on it for floating-point calculations that standard PHP floats cannot handle with sufficient precision. If your package manager complains about this missing extension, you cannot proceed until the extension is compiled and loaded into your specific PHP build.

The confusion often stems from the initial warning you see: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll'. This error indicates that your PHP installation itself has a broken configuration regarding OpenSSL. Before Composer can even resolve dependencies, it tries to initialize the PHP runtime. If the startup files in /etc/php/7.0/cli/conf.d/ are pointing to non-existent .so or .dll files, Composer will fail immediately with a generic "dependencies could not be resolved" error.

To fix this specific instance, you must address two distinct layers: the OpenSSL configuration and the missing bcmath extension.

Fixing the OpenSSL Startup Error

The path /usr/lib/php/20151012/php_openssl.dll suggests an older or mismatched PHP build (the timestamp 20151012 corresponds to PHP 5.6 or early 7.0 builds). Modern PHP distributions usually ship with .so files, not .dll, and they are typically located in /usr/lib/php/20151012/ or within the versioned conf.d directory.

Check your current configuration by running:

php --ini

Review the output to ensure it points to the correct PHP version (likely /etc/php/7.0/cli/php.ini). Then, inspect the conf.d directory to see if there is an entry explicitly loading openssl. If you see a line like extension=openssl.so or extension=/usr/lib/php/20151012/php_openssl.dll, and the file does not exist in that specific path, you need to comment out that line.

Edit the file:

sudo nano /etc/php/7.0/cli/conf.d/10-opcache.ini # or wherever openssl is defined

Or check a dedicated extension_openssl.ini if it exists. Ensure the extension=... line references a valid .so file path that actually exists on your filesystem. If you are on Debian-based systems, the extension is usually named php7.0-openssl. You may need to install the correct package:

sudo apt-get update
sudo apt-get install php7.0-openssl

After installing or correcting the path, restart your PHP-FPM or Apache service if you are using a web server, though for CLI tools like Composer, a simple php -r "echo phpversion('openssl');" should suffice to verify the fix without a full service restart.

Installing the bcmath Extension

Once the OpenSSL error is resolved and the CLI can start cleanly, address the primary blocker: bcmath. The error message confirms that Composer cannot find the extension.

On Debian/Ubuntu systems, this is straightforward:

sudo apt-get install php7.0-bcmath

If you are compiling PHP from source, you must have passed --with-bcmath during the ./configure step and ensure the .so file exists in your library path (e.g., /usr/lib/php/20151012).

Verifying the Resolution

After installing the packages and ensuring no broken paths exist in your php.ini, verify that both extensions are loaded:

php -m | grep -E "bcmath|openssl"

You should see bcmath listed. If it is missing despite installation, check if the extension is disabled in the conf.d directory or if you are running a different PHP binary than the one used to install the packages (e.g., mixing php7.0 binaries with php8.0 system libraries).

Why This Happens

This issue frequently arises when bootstrapping fresh servers using outdated package repositories or when upgrading PHP versions without updating all dependent extensions. The php-amqplib library has strict dependency checks; it will not downgrade to a version that doesn't use bcmath because the underlying AMQP protocol often relies on precise decimal handling for message IDs and timestamps in certain contexts.

By resolving the broken OpenSSL link first, you allow Composer to proceed past the initialization phase. Once the interpreter is healthy, adding php7.0-bcmath satisfies the library's requirement, allowing the dependency resolution to complete successfully.

Our network