一 错误信息
点击查看代码
# 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