Composer 无法在 Windows 上运行,出现 [ComposerExceptionNoSslException] 错误
我正在尝试在 Windows 10 上安装 laravel.我安装了 composer 来安装 laravel,但它给了我以下错误.
I'm trying to install laravel on windows 10. I installed composer to install laravel but it gives me below error.
[ComposerExceptionNoSslException] openssl 扩展是SSL/TLS 保护需要,但不可用.如果你可以的话不启用 openssl 扩展,你可以禁用这个错误,在将 'disable-tls' 选项设置为 true,风险自负.
[ComposerExceptionNoSslException] 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...
我检查了 this 问题并使用了解决方案,但它对我不起作用..
I checked out this question and used solutions but it didin't work for me..
我尝试了这些解决方案
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
推荐答案
我也遇到了同样的问题.我做了以下事情来确保作曲家能奏效.
I had the same issue. I did the following things to make sure the composer works out.
- 找到与您发出命令的位置相对应的 php.ini.
php --ini
校正前的样本输出:
Configuration File (php.ini) Path: C:WINDOWS
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
这里的 C:WINDOWS 是个骗局.当我查看php安装目录时,我发现没有php.ini.有两个文件 php.ini-development
和 php.ini-production
.只需将一个重命名为 php.ini
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
那么当你执行 php --ini
- 设置扩展目录
然后,打开 php.ini 文件并取消注释以下行;extension_dir = "ext"
应该是
Afterwards, open the php.ini file and uncomment the following line
;extension_dir = "ext"
should be
extension_dir = "ext"
- 启用扩展
然后以相同的方式取消注释扩展.通常需要以下内容.(但请从您从 composer 命令中看到的消息中找出您需要什么)
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
相关文章