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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...