Ubuntu 22.04 LTS和作曲家卷发错误60- SSL证书问题:无法获得本地发行人证书

发布于 2025-02-07 15:45:59 字数 1290 浏览 2 评论 0 原文

当我将基于作曲家的项目或“诊断”命令 Composer诊断-VVV 使用“诊断”命令时,我会得到错误:

“下载 https://repo.packagist.org/packages.org/packages.json :SSL证书问题:无法获得本地发行人证书“

我已经尝试:

  • 更新到最新的Ubuntu(22.04),并专门使用:
sudo apt install ca-certificates --reinstall
sudo update-ca-certificates -f
sudo mkdir -p /etc/pki/tls/certs
sudo ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt

实际上,诊断为预期:

检查ca file /etc/pki/tls/certs/ca-bundle.crt:有效

  • 重播作曲家安装程序

一些可能有用的信息:

Composer version: 2.2.6
PHP version: 8.1.2
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
cURL version: 7.81.0 libz 1.2.11 ssl OpenSSL/3.0.2

Whenver I use simple commands (install/update) for a Composer-based projects or the "diagnose" command composer diagnose -vvv, I get the error:

"curl error 60 while downloading https://repo.packagist.org/packages.json: SSL certificate problem: unable to get local issuer certificate"

I already tried to:

  • Update to the latest Ubuntu (22.04) and specifically used:
sudo apt install ca-certificates --reinstall
sudo update-ca-certificates -f
sudo mkdir -p /etc/pki/tls/certs
sudo ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-certificates.crt

And in facts the diagnose says, as expected:

Checked CA file /etc/pki/tls/certs/ca-bundle.crt: valid

  • Rerun the Composer installer

Some more information that could be useful:

Composer version: 2.2.6
PHP version: 8.1.2
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
cURL version: 7.81.0 libz 1.2.11 ssl OpenSSL/3.0.2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

定格我的天空 2025-02-14 15:45:59

重新运行 Composer installer 。 IIRC IT带有自己的证书商店或至少有一些后备包。

对于您的操作系统,请使用标准更新过程。

Re-run the composer installer. IIRC it ships with its own certificate store or at least has some fallback package.

For your operating system, use the standard update procedure.

烙印 2025-02-14 15:45:59

最终通过手动替换ca-bundle.crt文件来解决它,因为意识到即使是简单的curl/wget cli命令(在PHP/Composer之外)返回了相同的错误(这是-no-check-的原因下面的证书):

sudo mv /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt.backup
sudo wget -O /etc/ssl/ca-bundle.crt https://curl.se/ca/cacert.pem --no-check-certificate

我从: https://curl.se/docs/caextract/caextract /a>

Finally managed to solve it by manually replacing the ca-bundle.crt file, after realizing that even a simple curl/wget CLI command (outside of PHP/Composer) returned the same error (this the reason of the --no-check-certificate below):

sudo mv /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt.backup
sudo wget -O /etc/ssl/ca-bundle.crt https://curl.se/ca/cacert.pem --no-check-certificate

I got the link from: https://curl.se/docs/caextract.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文