I have php-nts and composer installed (both via scoop). This is what happens when I use Composer (composer require):
[Composer\Exception\NoSslException]
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 'disable-tls' option to true.
Looks like the OpenSSL extension is missing. It would be great to have this automatically installed as well. And by the way, does anyone have any tips on how to fix this using best practices?
Links that might be useful:
https://secure.php.net/manual/en/openssl.installation.php
Openssl is not enabled by default. See https://github.com/php/php-src/blob/master/php.ini-production. Remove the semicolon before extension=openssl
Thanks @rasa!
Does CLI PHP ignore ~/scoop/persist/php/cli/php.ini by default?
I force it with php -c path/to/php.ini.
@zored Scoop adds PHP_INI_SCAN_DIR to the environment with ~/scoop/persist/php/cli and ~/scoop/persist/php/cli/conf.d, so it should load php.ini from there.
Check if PHP_INI_SCAN_DIR is set and add it manually.
@r15ch13 thank you! For some reason it appeared after Windows restart.
Run these commands in the Windows terminal:
cd /d “%HOMEDRIVE%\%HOMEPATH%\scoop\apps\php\current\cli\conf.d”
echo extension=openssl >> openssl.ini
Thanks @rasa
Just started with _scoop_ on win10 and _composer_ immediately complained about _'tls'_. Your answer saved me.
Openssl is not enabled by default. See https://github.com/php/php-src/blob/master/php.ini-production. Remove the semicolon before
extension=openssl
I tried installing a composer module with composer require global ...
2 But when I change the php.ini and remove the semicolon before
;extension=openssl
it keeps on coming back after i restart my laragon @rasa
@abrhambas01 try @kenorb’s solution:
cd /d “%HOMEDRIVE%\%HOMEPATH%\scoop\apps\php\current\cli\conf.d”
echo extension=openssl >> openssl.ini
I used laragon in mine. Miraculously, I now got it back, Thank God
fwiw I had to use the absolute path including full filename of php_openssl.dll before it would work.
Having this issue right now and no solution has worked thus far. Any other suggestions? Running PHP 7.2.23, Composer 1.83, installed with Laragon and cannot run create-project right now. It has worked in the past but just changed the php version since I was unknowingly running on php 5.6.
Do you use the laragon terminal? It may use the wrong php version.
What is the output of php --ini?
The php version (7.2.19) bundled with laragon has openssl activated.
But it fails for me because it tries to load my php73-xdebug.dll via %PHP_INI_SCAN_DIR%
C:\laragon\www
λ php -v
Failed loading D:\scoop\apps\php-xdebug\current\php_xdebug.dll
PHP 7.2.19 (cli) (built: May 29 2019 13:58:59) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies
C:\laragon\www
λ php --ini
Failed loading D:\scoop\apps\php-xdebug\current\php_xdebug.dll
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\laragon\bin\php\php-7.2.19-Win32-VC15-x64\php.ini
Scan for additional .ini files in: D:\scoop\apps\php\current\cli;D:\scoop\apps\php\current\cli\conf.d;
Additional .ini files parsed: D:\scoop\apps\php\current\cli\php.ini,
D:\scoop\apps\php\current\cli\conf.d\cacert.ini,
D:\scoop\apps\php\current\cli\conf.d\extensions.ini,
D:\scoop\apps\php\current\cli\conf.d\opcache.ini,
D:\scoop\apps\php\current\cli\conf.d\sizes.ini,
D:\scoop\apps\php\current\cli\conf.d\timezone.ini,
D:\scoop\apps\php\current\cli\conf.d\xdebug.ini
How did you force laragon to use the scoop php version?
Composer with laragons php version works (except for the wrong xdebug.dll)

Removed all php from laragons bin directory and used php73 via scoop and it works fine.

It all began when I ran into problems in a Laravel project and noticed that I was running on php 5.6. I changed the php version my machine was running on to 7.3.10 then noticed that it had issues with Laravel. Last night I changed it to php 7.2.23 and thought that would fix it. It didn't.
When I ran composer why-not I got a new message:
Symfony\Component\Console\Exception\RuntimeException Not enough arguments (missing: "package")
I figured that I was missing some dependency connections from changing the php version from 5.6 to 7.2.23. I got mad, downloaded Composer and reinstalled it manually.
It worked and I got the project created. Seems to work now.
I reinstalled composer, now it is working like a charm. If you have xampp installed on your windows machine composer copies your C:\xampp\phpphp.ini-production File to C:\xampp\phpphp.ini. You could also do this step manually. I've been experiencing this issue by upgrading my php version in xampp manually, so the "composer php.ini" was missing imao. Hope this helps someone.
Hee heeee - Shamona!
The echo command worked for me (if anyone has an idea why, I'd like to know).
But I'd also like to know why the initial solution doesn't work?
Why is uncommenting extension=openssl not enough?
When I check phpinfo(), I see that extension_dir is set to C:/php/ext, why is that?
I have same error.
1) Leave uncommented extension=openssl
;extension=openssl
2) Add the path to the extension dir:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "C:/laragon22/bin/php/php-7.4.5-nts-Win32-vc15-x64/ext"
My english is poor. Sorry
Try to run composer with sudo, that solved it for me.
--------- AM ON WINDOWS 10 -----
Hi , I want to give a stupid solution... but some one can run into it, after trying to update to PHP 7.4.10 the last version, I uncomment and made A LOT OF THINGS... I was reading the files inside the PHP and just came out that there wasent a php.ini file so I copy the file called
php.ini-development -> to php.ini make a copy // I DID NOT HAVE THAT FILE!!! check your folder!!
copy and paste and rename it to php.ini ---------- this file was the one I modify , after that I re run all and that make the magic :) so --------- AM ON WINDOWS 10 ----- HOPE SOME ONE HELPS THIS
Most helpful comment
Openssl is not enabled by default. See https://github.com/php/php-src/blob/master/php.ini-production. Remove the semicolon before
extension=openssl