Home >Backend Development >PHP Tutorial >Why Isn't Composer Recognizing the Openssl Extension Despite Adding It to php.ini?

Why Isn't Composer Recognizing the Openssl Extension Despite Adding It to php.ini?

Barbara Streisand
Barbara StreisandOriginal
2024-11-05 06:18:02735browse

Why Isn't Composer Recognizing the Openssl Extension Despite Adding It to php.ini?

Composer SSL/TLS Protection Issue: "The openssl extension is required for SSL/TLS protection"

When attempting to execute the command:

composer create-project flarum/flarum . --stability=beta

an error may be encountered:

[RuntimeException]
The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.

Unable to Enable Openssl Despite Modifying "php.ini"

Despite adding "extension=php_openssl.dll" to "php.ini," the error persists.

Solution: Disabling TLS for Temporary Relief

As a temporary solution for non-production environments, consider disabling TLS for Composer:

composer config -g --disable-tls true

Re-run Composer afterwards. This approach is not recommended for production servers due to security implications.

Permanent Resolution: Enabling PHP Openssl

To address the issue permanently, enable the PHP Openssl extension. Ensure the PHP Openssl extension is installed and enabled in the php.ini file.

Adding Openssl Extension to "php.ini"

  • Linux/OSx: extension=php_openssl.so
  • Windows: extension=php_openssl.dll

Reload php-fpm or Web Server

Reload php-fpm or the web server as necessary.

Update for PHP 7.4 and Later

For PHP 7.4 and later, the extension name is simply "openssl," even for Windows.

The above is the detailed content of Why Isn't Composer Recognizing the Openssl Extension Despite Adding It to php.ini?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn