Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer not working on windows, gives [Composer\Exception\NoSslException] error

I'm trying to install laravel on windows 10. I installed composer to install laravel but it gives me below error.

[Composer\Exception\NoSslException] 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.

Command doesn't matteri it gives above error with all commands...

I checked out this question and used solutions but it didin't work for me..

I tried these solutions

composer config -g -- disable-tls true

extension=php_openssl.dll // open openssl extension in php.ini file. - I restarted apache after that but nothing changed
like image 863
Veysel BAYAR Avatar asked Oct 01 '18 15:10

Veysel BAYAR


People also ask

How do you solve a composer error?

To solve the Memory exhausted issue, you can try running composer with an Unlimited memory flag like this: php -d memory_limit=-1 /usr/local/bin/composer [COMMAND] or php -d memory_limit=-1 composer. phar [COMMAND] when using a local composer. If that doesn't help, you can upgrade your hosting plan.


1 Answers

I had the same issue. I did the following things to make sure the composer works out.

  • Find the php.ini which corresponds to where you issue the command from.

php --ini

sample output before correction:

Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

This C:\WINDOWS here is a hoax. When I looked in the php installation directory, I found out there is NO php.ini. There are two files php.ini-development and php.ini-production. Just rename one to php.ini

Then you should see the correct ini path when you do php --ini

  • Set the extensions directory

Afterwards, open the php.ini file and uncomment the following line ;extension_dir = "ext" should be

extension_dir = "ext"
  • Enable extensions

Then uncomment the extensions the same way. The following are usually required. (But please find out what you need from the messages you see from composer commands)

extension=fileinfo
extension=gd2
extension=mbstring
extension=openssl
like image 195
Tharaka Devinda Avatar answered Oct 20 '22 03:10

Tharaka Devinda