error:14090086:SSL routines:SSL3_GET_SERVER_CERTIE

我的操作系统是linux Deepin2014.3, 64bit。采用的xampp-linux-x64-5.6.8-0-installer.run经过一系列配置,

安装的php,YII2.0框架,PHP版本高于5.4,调用这个命令的时候出问题了。

composer global require "fxp/composer-asset-plugin:1.0.0"

弹出这样的问题

Changed current directory to /home/litianci/.composer
./composer.json has been updated
Loading composer repositories with package information
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failedhttps://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of dateUpdating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

看问题是SSL的验证问题,网上搜索了很久没有解决.

下面是来自某被墙的网页的快照。没办法,贴网址也无效。

经过原因查找,在验证证书的时候出现问题,是本地ssl判别证书太旧,导致报ssl证书错误

解决方案一、

下载新的ssl本地判别文件

    wget http://curl.haxx.se/ca/cacert.pem

并更名为ca-bundle.crt放置到默认目录。如果该目录不存在可以创建。

     mv cacert.pem ca-bundle.crt  | mv ca-bundle.crt /etc/pki/tls/certs/

或者curl  –cacert cacert.pem 方式指定调用

然后无意中更改了一下xampp-linux-x64-5.6.8-0-installer.run为一个老的版本xampp-linux-x64-1.8.3-5-installer.run,竟然可以使用了,你不妨换换版本的。

我在deepin2014.3,64bit操作系统下测试成功解决该error.

解决方案二、[版本太老,不建议用]

借鉴 http://pkg.phpcomposer.com/ 。感谢分享。

修改~/.composer/config.json,添加

{
    "repositories": [
        {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"},
        {"packagist": false}
    ]}

最终是这样子的。

{
    "config": {

    },
    "repositories": [
        {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"},
        {"packagist": false}
    ]}

最终测试可以使用。

解决方案三[完美解决]

参考:https://github.com/composer/composer/issues/3346

First: Check certificate file location which will be in default_cert_file key, you will found it in openssl_get_cert_locations() its php openssl function:

找到验证文件在哪里?

这个发现在

/opt/lampp/share/openssl/cert.pem
$ php -r "print_r(openssl_get_cert_locations());"
Array
(
    [default_cert_file] => /opt/lampp/share/openssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /opt/lampp/share/openssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /opt/lampp/share/openssl/private
    [default_default_cert_area] => /opt/lampp/share/openssl
    [ini_cafile] => 
    [ini_capath] => 
)

Second: Download http://curl.haxx.se/ca/cacert.pem:

$ wget http://curl.haxx.se/ca/cacert.pem

Third: Copy certificate PEM file into default_cert_file location:

$ sudo mv cacert.pem /opt/lampp/share/openssl/cert.pem

My php-cli is under XAMPP and default_cert_file maybe point to some place that is different than this.

Fourth:Restart xampp:

$ sudo /opt/lampp/xampp restart

I hope anything after that should goes fine with you brothers.

https://my.oschina.net/bubifengyun/blog/469277

### 回答1: 这个错误的含义是 "ssl23_get_server_hello: tlsv1 alert protocol version",意思是 SSL 协议中检测到了不支持的协议版本。可能是因为服务器端使用的 SSL/TLS 协议版本过低或过高,导致连接不成功。 ### 回答2: 在网络通信中,SSL协议是一种用于保障通信安全的协议。当客户端与服务器之间进行SSL握手时,若两端协议版本不一致,可能会导致握手失败,从而出现error:1407742e:ssl routines:ssl23_get_server_hello:tlsv1 alert protocol version的错误。 通常,该错误是由于客户端或服务器使用的SSL协议版本不一致导致的。例如,当客户端尝试使用TLSv1.2版本与服务器进行通信,但服务器只支持TLSv1.1时,就会出现该错误。在这种情况下,客户端会发送一个tlsv1 alert protocol version警告给服务器,提示协议版本不匹配,导致握手失败。 为了解决这个问题,需要检查客户端和服务器使用的SSL协议版本是否一致。如果不一致,可以尝试升级其中一个协议版本,或者让双方都支持两种协议版本,从而保证通信的顺利进行。 此外,当出现该错误时,还可以检查是否有防火墙或代理服务器等中间设备对SSL通信进行了拦截或篡改,从而导致协议版本不一致。如果存在这样的问题,应该对中间设备进行相应的配置调整,以确保正常的SSL通信。 ### 回答3: 该错误代码错误:1407742e:ssl routines:ssl23_get_server_hello:tlsv1警报协议版本,通常是因为服务器或客户端使用不受支持的 TLS(安全传输层)协议版本。TLS是一种用于保护互联网通信安全的协议,在网上银行、电子邮件和其他敏感信息的传输中得到了广泛应用。 当服务器和客户端之间的通信请求使用暂不支持的协议时,访问中断并返回此错误。因此,用户需要保证服务器和客户端使用的 TLS 协议版本是彼此兼容的。大多数现代浏览器均兼容 TLS1.2 或更高版本,许多老版本浏览器使用的协议版本可能已经过时,需要更新或升级浏览器。 此外,确保服务器和客户端的时间同步和准确也很重要。如果服务器的时间与客户端时间差距太大,则可能会导致 TLS 通信失败。如果 HTTP 服务器的时间与证书的有效期不一致,也会引起此错误。因此,建议用户确保服务器证书正确,并在必要时更新或更换证书。 总的来说,当出现此错误时,用户应该检查确认服务器和客户端所使用的 TLS 协议版本是否兼容,并确保服务器证书的有效期和时间与本地相同。如果问题仍然存在,则需要咨询网络服务的供应商或 IT 专业人员以获得更多支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值