Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The openssl extension is required for SSL/TLS protection

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

I try to run this command, but it gave me this error.

  [RuntimeException]                                                              The openssl extension is required for SSL/TLS protection but is not availab     le. 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.   

I tried to add "extension=php_openssl.dll" to "php.ini", but it still got this error

like image 900
Mike Yang Avatar asked Feb 07 '16 04:02

Mike Yang


People also ask

How do you fix the openssl extension is required for SSL tls protection but is not available?

[RuntimeException] The openssl extension is required for SSL/TLS protection but is not availab le. 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.

How do I enable SSL tls protection?

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 'disabl e-tls' option to true.


1 Answers

The same error occurred to me. I fixed it by turning off TLS for Composer, it's not safe but I assumed the risk on my develop machine.

try this:

composer config -g -- disable-tls true 

and re-run your Composer. It works to me!

But it's unsecure and not recommended for your Server. The official website says:

If set to true all HTTPS URLs will be tried with HTTP instead and no network-level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini.

If you don't want to enable unsecure layer in your machine/server, then setup your php to enable openssl and it also works. Make sure the PHP Openssl extension has been installed and enable it on php.ini file.


To enable OpenSSL, add or find and uncomment this line on your php.ini file:

Linux/OSx:

extension=php_openssl.so 

Windows:

extension=php_openssl.dll 

And reload your php-fpm / web-server if needed!

UPDATE:

As of PHP 7.4 the extension is named extension=openssl (known for Windows).

like image 161
Vinícius Medeiros Avatar answered Nov 15 '22 13:11

Vinícius Medeiros