当前位置:首页 > 操作系统 > MacOs

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

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

<code>cURL error 58: SSL: Can't load the certificate "..." and its private key: OSStatus -25299
</code>

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

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

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

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

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

<code>$brew uninstall curl
$brew install curl --with-openssl
$brew link curl --force
$curl --version
</code>

但它并没有解决问题.

请告诉我我做错了什么.

谢谢.

解决方法:

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

<code>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
</code>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐