curl: (60) The certificate issuer's certificate has expired. Check your system date and time.


一 錯誤信息

點擊查看代碼
# curl https://packagist.phpcomposer.com/packages.json
curl: (60) The certificate issuer's certificate has expired.  Check your system date and time.
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.

二 解決辦法

2.1 瀏覽器訪問鏈接

2.2 找到網站證書並導出

2.3 打開導出的證書

2.4 將內容追加到 /etc/pki/tls/certs/ca-bundle.crt

# vim /etc/pki/tls/certs/ca-bundle.crt

三 驗證結果

點擊查看代碼
# curl https://packagist.phpcomposer.com/packages.json -v
* About to connect() to packagist.phpcomposer.com port 443 (#0)
*   Trying 39.104.163.221...
* Connected to packagist.phpcomposer.com (39.104.163.221) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* Server certificate:
*       subject: CN=*.phpcomposer.com
*       start date: Aug 23 16:02:51 2021 GMT
*       expire date: Nov 21 16:02:50 2021 GMT
*       common name: *.phpcomposer.com
*       issuer: CN=R3,O=Let's Encrypt,C=US
> GET /packages.json HTTP/1.1
> User-Agent: curl/7.29.0
> Host: packagist.phpcomposer.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 02 Nov 2021 03:08:20 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 308
< Last-Modified: Sat, 20 Jun 2020 09:04:57 GMT
< Connection: keep-alive
< Vary: Accept-Encoding
< ETag: "5eedd139-134"
< Expires: Tue, 02 Nov 2021 03:08:20 GMT
< Cache-Control: max-age=0
< Access-Control-Allow-Origin: *
< Accept-Ranges: bytes
< 
{
  "packages":[],
  "notify":"https://packagist.org/downloads/%package%",
  "notify-batch":"https://packagist.org/downloads/",
  "metadata-url":"/p2/%package%.json",
  "search":"https://packagist.org/search.json?q=%query%&type=%type%",
  "providers-lazy-url":"https://repo.packagist.org/p/%package%.json"
}
* Connection #0 to host packagist.phpcomposer.com left intact

參考

https://blog.csdn.net/weixin_40006394/article/details/84790775

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM