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

Mary-Kate Olsen
Release: 2024-11-05 07:37:02
Original
733 people have browsed it

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.
Copy after login

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
Copy after login
  1. Windows: Uncomment or add the following line to your php.ini file:
extension=php_openssl.dll
Copy after login
  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
Copy after login

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
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!