centos php curl安装包下载,centos安装composer下载包curl时CA证书报错

昨晚在centos上安装composer,结果第一步curl就出现了报错:

[root@web01 ~]# curl -sS https://getcomposer.org/installer | php

curl: (60) Peer certificate cannot be authenticated with known CA certificates

More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"

of Certificate Authority (CA) public keys (CA certs). If the default

bundle file isn't adequate, you can specify an alternate file

using the --cacert option.

If this HTTPS server uses a certificate signed by a CA represented in

the bundle, the certificate verification probably failed due to a

problem with the certificate (it might be expired, or the name might

not match the domain name in the URL).

If you'd like to turn off curl's verification of the certificate, use

the -k (or --insecure) option.

看报错是证书的问题,因为从来没用过证书,也不是很懂,网上找了很多解决办法尝试完都没有解决:

1、按照提示加-k参数,发现没有证书无法下载;

2、去官网下载对应的证书到本地,通过各种配置、复制均无果;

3、放弃睡觉去了。

第二天早上接着弄,换了一个思路,去另一个地方搜索,因为我想的话,既然按照过程中大部分人都没有碰到这个问题,那么很可能是某个小细节出了问题,嗯,相信能找到答案,于是下一秒就在一篇哥们的文章中看到了时间问题,说可能由于时间不准确导致证书过期,一想完全是可能的,毕竟证书最常见的问题就是过期了,于是看了下我的系统时间:

[root@web01 log]# date

Sun May 12 19:07:14 CST 2019

居然是一年多前的时间!!!可能它也想停在2019,甚至跳到2021年,于是我很快将他带回现实:

[root@web01 log]# ntpdate time.nist.gov

11 Aug 09:30:38 ntpdate[5710]: step time server 132.163.97.6 offset 39450151.557448 sec

然后curl,问题解决:

[root@web01 ~]# curl -sS https://getcomposer.org/installer | php

All settings correct for using Composer

Downloading...

The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Network is unreachable

Retrying...

The "https://getcomposer.org/download/1.10.10/composer.phar.sig" file could not be downloaded: failed to open stream: Network is unreachable

Retrying...

Composer (version 1.10.10) successfully installed to: /root/composer.phar

Use it: php composer.phar

总结一下:问题总能解决,放好心态转换思路,最后感谢那位哥们,所有我也记录一下。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值