解决报错 [Composer\Exception\NoSslException] The openssl extension is required for SSL/TLS protection

执行composer命令的时候:

composer install 、update等操作时报错:
[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. 

这句话的意思是:ssl/tls保护需要openssl扩展,但不可用。如果您不能启用openssl扩展,您可以通过将“disable-tls”选项设置为true来禁用此错误,风险自负;

也就是说你可以通过启用openssl扩展或者把disable-tls这个配置项设置成true来解决这个问题;

一、首先启用openssl这个扩展,找到你的php.ini,

找到extension=php_openssl.dll这配置项,把前面的分号去掉,保存退出,重启php;

看看你的phpinfo() openssl 是否是enable开启状态;

使用composer命令试试,如果不行使用第二种方法;

二、将“disable-tls”选项设置为true

命令:composer config -g -- disable-tls true

命令如果不好用直接去改配置文件,把这项改成true

使用composer命令试试,一般这个时候是ok的了;

三、巨坑

我自己的服务器还是用不了,当我使用php -m查看我的拓展的时候,发现我的包里这个拓展竟然丢失了。。。没有这个拓展我phpinfo里openssl竟然是开启状态。。。

解决方案:装上这个拓展或者重装php

到这composer命令可以正常使用了

转载请说明出处:https://blog.csdn.net/qq_38174263/article/details/86741649

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值