码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2020-08-11 17:33:00      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:author   ntpdate   use   总结   http   htm   cst   ace   网上   

昨晚在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

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

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

标签:author   ntpdate   use   总结   http   htm   cst   ace   网上   

原文地址:https://blog.51cto.com/13054614/2518926

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!