windows中wamp环境composer使用中openssl问题解决

今天在windows下学习lavaral,使用composer update命令报如下错误:

 [ComposerExceptionNoSslException]


  The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl ex
  tension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.

大体意思就是composer要求使用openssl连接,百度相关问题,解决思路分为两种:

一、禁用openssl,结果是治标不治本放弃

二、开启php的openssl扩展,下载ca证书

具体操作如下:

1、开启php扩展,左键wamp-php-php扩展-php_openssl前面打勾。

2、在D:wampwampinphpphp5.4.12(看个人安装路径确定)下找到php.ini文件,用sublime打开。

查找 extension=php_openssl.dll ,删除extension=php_openssl.dll前面的分号,取消注释,从而启用OpenSSL插件。

注意:因为SSL连接需要认证,所以继续下面的步骤之前,需要准备好CA证书(建议把证书保存到D:wampwampinphpphp5.4.12verify目录中),可以从https://curl.haxx.se/docs/caextract.html处下载。(如果直接打开文件的话,另存为修改文件名即可)

3、如果php.ini文件中能够找到

;openssl.cafile=

和上面一样,去掉分号注释,设置CA证书为D:wampwampinphpphp5.4.12verify,即

openssl.cafile= "D:wampwampinphpphp5.4.12verifycacert.pem"如果无法找到直接添加

openssl.cafile= "D:wampwampinphpphp5.4.12verifycacert.pem"


完成上面操作再次在cmd环境中运行composer update 问题解决,参考文章

 http://blog.csdn.net/fjnjxr/article/details/54968072

我在安装的过程中,即便是满足了以上要求,还出现了一个类似于下面的错误,最终排查,是php_fileinfo未开启导致的,在php.ini中将这个配置项的注释去掉即可

To enable extensions, verify that they are enabled in those .ini files:
- X:wampphpphp.ini
You can also run `php --ini` inside terminal to see which files are used by PH
P in CLI mode.

来自:http://blog.csdn.net/u011120720/article/details/51983311

原文地址:https://www.cnblogs.com/cxscode/p/8360091.html