doumeng3080
2016-11-30 23:22
浏览 473
已采纳

如何在php.ini中向curl.cainfo添加多个ssl证书?

I'm running Apache locally for developing multiple sites and would like to run them simultaneously. The sites talk to each other over ssl, and since it is a local setup, I'm using self-signed certificates.

To get php(5.5.26) to accept these certificates, I added them to the curl.cainfo property in php.ini. I got it to work with one certificate, but when I try adding multiple (3), it doesn't work (I don't get anything back when making a request from one site to the other in php). I tried the following formats:

Separate Lines:

curl.cainfo=/path/to/certificate.crt
curl.cainfo=/path/to/another/certificate.crt
curl.cainfo=/path/to/last/certificate.crt

Same line, comma separated curl.cainfo=/path/to/certificate.crt,/path/to/another/certificate.crt,/path/to/last/certificate.crt

Same line, colon separated curl.cainfo=/path/to/certificate.crt:/path/to/another/certificate.crt:/path/to/last/certificate.crt

Any other ideas?

图片转代码服务由CSDN问答提供 功能建议

我在本地运行Apache以开发多个站点,并希望同时运行它们。 这些站点通过ssl相互通信,因为它是本地设置,我使用的是自签名证书。

要让php(5.5.26)接受这些证书, 我将它们添加到 php.ini 中的 curl.cainfo 属性中。 我得到它使用一个证书,但是当我尝试添加多个(3)时,它不起作用(我在php中从一个站点向另一个站点发出请求时没有得到任何回报)。 我尝试了以下格式:

单独的行:

  curl.cainfo = / path / to / certificate.crt 
curl.cainfo  = / path / to / another / certificate.crt 
curl.cainfo = / path / to / last / certificate.crt 
   
 
 

相同的行,逗号分隔 <代码> curl.cainfo = /路径/到/ certificate.crt,/路径/到/另一个/ certificate.crt,/路径/到/最后/ certificate.crt < p>相同的行,冒号分隔 curl.cainfo = / path / to / certificate.crt:/path/to/another/certificate.crt:/path/to/last/certificate.crt

还有其他想法吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douliaopan1419 2016-12-01 07:51
    已采纳

    The underlying CURLOPT_CAINFO option in libcurl only supports a single file name, and PHP/CURL merely passes on that string to libcurl. So no, you cannot pass more than one file name. You can however concatenate all those files into a single one, and point to that.

    点赞 打赏 评论

相关推荐 更多相似问题