26

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
11
  • Are you sure you changed the right php.ini file. Do a php --ini to see which php.ini file your PHP CLI is using Commented Oct 1, 2018 at 15:39
  • 1
    The PHP CLI and the PHP used by Apache are not necessarily related to each other. Restarting Apache is Irrelevant to PHP CLI and again makes me think you are editing the wrong php.ini file Commented Oct 1, 2018 at 15:41
  • @RiggsFolly I see but I'm sure about I edited correct php.ini file. Because I checked before editing using phpinfo() method Commented Oct 1, 2018 at 15:46
  • 1
    from the terminal do > php --ini and look at the output. It will tell you which php.ini file is being used by the PHP CLI Commented Oct 1, 2018 at 15:49
  • 1
    I would have to guess that you have 2 PHP's installed. I would also guess that you PATH is pointing to the PHP5 folder and thats why you get that in the CLI. Check your PATH and if I am right change the PATH to point to the PHP7 folder Commented Oct 2, 2018 at 9:47

2 Answers 2

79

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
Sign up to request clarification or add additional context in comments.

5 Comments

Just copying the php.ini to C:\Windows sufficed for me
If this doesn't help, try this: youtrack.jetbrains.com/issue/WI-52973
Waw your my angel.
This should have been the correct and voted answer!!!!!!!!!!!!! it works like charm
everything is correct but for some reason i don't see the Path: C:\WINDOWS it is just empty when i type php --ini
5

I was running php7.2.x on my Windows 10 machine before I upgraded to PHP 7.4.10 (cli)

When I first pulled up the php.ini file, to my surprise, it was empty.

To be sure that I was looking at the right file, I did

php --ini

I was looking at the correct file.

I looked at the php folder of XAMPP and noticed two files:

  1. php.ini-production.ini
  2. php.ini-development.ini

I copied the contents of the first file and pasted in my php.ini file. Then after a restart, I saw a ton of other modules were not being loaded.

I then went in to my php.ini file's Dynamic Extensions sections and had to uncomment all the following extensions:

extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
extension=odbc
extension=openssl
extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop

And then restarted Apache server agan, after saving my php.ini file.

This time, everything worked!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.