Home  >  Article  >  Backend Development  >  Why Am I Getting the "The openssl extension is required for SSL/TLS protection" Composer Error?

Why Am I Getting the "The openssl extension is required for SSL/TLS protection" Composer Error?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-11-05 07:37:02734browse

Why Am I Getting the

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

When attempting to use Composer, you may encounter the following error message:

The openssl extension is required for SSL/TLS protection but is not available.

This error indicates that your PHP installation lacks the OpenSSL extension, which is essential for establishing secure SSL/TLS connections.

Fixing the Error

To resolve this issue, you can either enable the OpenSSL extension in your PHP configuration or disable TLS verification for Composer.

Enabling OpenSSL

  1. Linux/OSx: Uncomment or add the following line to your php.ini file:
extension=php_openssl.so
  1. Windows: Uncomment or add the following line to your php.ini file:
extension=php_openssl.dll
  1. Restart your PHP web server (e.g., Apache or Nginx).

Disabling TLS for Composer

This is not recommended, as it may compromise the security of your Composer communications. However, if you are working on a development machine and wish to proceed, run the following command:

composer config -g -- disable-tls true

This will suppress the TLS verification error for Composer. However, it is crucial to note that this should not be used on production servers.

For PHP 7.4 or Later

In PHP versions 7.4 and above, the extension name has changed to simply "openssl." Therefore, adjust the php.ini configuration accordingly:

extension=openssl

Restart your PHP web server, and the issue should be resolved.

The above is the detailed content of Why Am I Getting the "The openssl extension is required for SSL/TLS protection" Composer Error?. 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