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
extension=php_openssl.so
extension=php_openssl.dll
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!