SHA384 is not supported by your openssl extension, could not verify the phar file integrity
When running composer self-update on Windows 10 with PHP 7.3.2, you might encounter a cryptic error message that halts the update process:
[RuntimeException]
SHA384 is not supported by your openssl extension, could not verify the phar file integrity
This error indicates a fundamental mismatch between what Composer expects and what your PHP environment can provide. Composer relies heavily on the OpenSSL extension to verify the integrity of downloaded .phar files before executing them. This verification is a critical security step designed to ensure that the file hasn't been tampered with during transmission.
The specific failure here, "SHA384 is not supported," points directly to the version of the OpenSSL library compiled into your PHP installation. Modern versions of Composer and its associated packages often utilize SHA-384 for their digital signatures. However, PHP 7.3.2 was released in October 2019, a time when many Windows builds still relied on older OpenSSL configurations or bundled libraries that defaulted to SHA-256 as the highest supported hash algorithm.
If your system's OpenSSL extension only supports up to SHA-256, it cannot validate a signature generated with SHA-384. Consequently, Composer throws a RuntimeException because it refuses to run an unverified script, even if the file appears correct on disk. This is a hard security boundary; bypassing it would undermine the integrity checks Composer performs.
To resolve this, you must ensure your PHP environment supports SHA-384. Since Windows builds of PHP often come pre-configured with specific OpenSSL versions, you should first check which algorithms are actually enabled in your current setup. Run the following command in your terminal:
php -m | findstr openssl
php -r "echo hash_algos();"
If hash_algos() does not list sha384, your OpenSSL extension is indeed too old for the current Composer release. The most straightforward fix on Windows is to update your PHP runtime. Upgrading from PHP 7.3.2 to PHP 7.4 or PHP 8.x typically resolves this immediately, as newer distributions bundle a more recent OpenSSL library that supports SHA-384 by default.
If upgrading PHP is not an option due to legacy application constraints, you might consider recompiling PHP with a newer OpenSSL version, though this is often cumbersome on Windows compared to using pre-compiled binaries from sources like php.net or the official PHP website.
Alternatively, you can attempt to force Composer to use SHA-256 for verification by downgrading the composer/composer package slightly, but this is generally discouraged as it may introduce other compatibility issues with modern packages. The trade-off here is between maintaining an outdated security posture versus forcing a workaround that might break future updates.
In production environments, especially those managed by hosting providers or using containerization like Docker, ensure that the base image includes a PHP version that explicitly supports SHA-384. For example, using a PHP 7.4+ official Docker image eliminates this specific issue without manual intervention.
Ultimately, the error is not a bug in Composer but a signal that your runtime environment has fallen behind the current cryptographic standards required for secure package management. Updating your PHP version to one that ships with a modern OpenSSL implementation remains the most robust and future-proof solution.
