Home >Backend Development >PHP Tutorial >Why Does Composer Fail with 'The openssl extension is required for SSL/TLS protection'?

Why Does Composer Fail with 'The openssl extension is required for SSL/TLS protection'?

Barbara Streisand
Barbara StreisandOriginal
2024-11-05 05:37:02645browse

Why Does Composer Fail with

Unresolved SSL/TLS Protection on Composer Projects

When attempting to create a Flarum project using Composer, users may encounter the error "The openssl extension is required for SSL/TLS protection." Despite attempts to include "extension=php_openssl.dll" in the "php.ini" file, the issue persists.

Solution: Disable TLS for Development Environments

While not recommended for production environments due to security concerns, disabling TLS for local development can resolve the error. Execute the following command to disable TLS:

composer config -g -- disable-tls true

Re-run Composer to check if the issue has been resolved. It's crucial to keep in mind that this solution is intended solely for development purposes and should not be implemented in production environments.

Properly Configuring OpenSSL for Secure HTTPS Connections

For a more secure and recommended approach, ensure that the PHP Openssl extension is installed and enabled in the "php.ini" file. Locate or add the following line, depending on your operating system:

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

Reload your PHP-FPM or web server if necessary.

Extension Naming Updates in PHP 7.4

In PHP 7.4, the extension name was simplified to "extension=openssl," an important update to keep in mind. Implementing this change in your "php.ini" file will address the error.

The above is the detailed content of Why Does Composer Fail with 'The openssl extension is required for SSL/TLS protection'?. 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