微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – cURL错误58:SSL:无法加载证书“…”及其私钥:Mac上的OSStatus -25299

代码在Ubuntu vagrant Box上工作正常,但在本地MacO上它没有加载sertificates说

cURL error 58: SSL: Can't load the certificate "..." and its private key: Osstatus -25299

我研究过Mac有一点支持OS X本机API而不是OpenSSL.

我需要将pem证书转换为像这样的pkcs12.

openssl pkcs12 -export -in ./client.crt -inkey ./client.pem -out client.p12

但这对我不起作用,因为我的PHP服务器在Ubuntu上,我不想破坏正常工作.我的任务是让它在Mac上运行.

我宁愿用openssl支持安装curl.我试过这个:

$brew uninstall curl
$brew install curl --with-openssl
$brew link curl --force
$curl --version

但它并没有解决问题.

请告诉我我做错了什么.

谢谢.

解决方法:

如问题中所述,通过brew安装curl并使用openssl支持是正确的方法.但是你需要从它的安装目录/usr/local/opt / curl / bin / curl -v -k –key中明确地调用它,因为brew不会将它链接到/usr/local,如安装中所述

This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/curl/lib
    CPPFLAGS: -I/usr/local/opt/curl/include
For pkg-config to find this software you may need to set:
    PKG_CONfig_PATH: /usr/local/opt/curl/lib/pkgconfig

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐