...cURL error 60: SSL certificate problem: unable to get local issuer certificate...
Posted bneglect
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了...cURL error 60: SSL certificate problem: unable to get local issuer certificate...相关的知识,希望对你有一定的参考价值。
- 问题描述: 在做php爬虫的时候, 安装了 guzzle 和 dom-crawler 之后, 调用的时候出现问题, 如下
- 报错内容:
Fatal error: Uncaught GuzzleHttpExceptionRequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in E:projectmy_testvendorguzzlehttpguzzlesrcHandlerCurlFactory.php:186 Stack trace: #0 E:projectmy_testvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(149): GuzzleHttpHandlerCurlFactory::createRejection(Object(GuzzleHttpHandlerEasyHandle), Array) #1 E:projectmy_testvendorguzzlehttpguzzlesrcHandlerCurlFactory.php(102): GuzzleHttpHandlerCurlFactory::finishError(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory)) #2 E:projectmy_testvendorguzzlehttpguzzlesrcHandlerCurlHandler.php(43): GuzzleHttpHandlerCurlFactory::finish(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory)) #3 E:projectmy_testvendorguzzlehttpguzzlesrcHandlerProxy.php(28): GuzzleHttpHandler in E:projectmy_testvendorguzzlehttpguzzlesrcHandlerCurlFactory.php on line 186
这是在Windows下PHPstudy环境测试的, 没有在Linux上试验, 不知道Linux会不会出现这样的错误. 这里只说Windows的解决方案, Linux如果出现大概也是同样的解决方法.
- 下载cacert.pem, 下载地址: https://curl.haxx.se/ca/cacert.pem
- 修改php.ini的curl配置, 找到 [curl] 模块, 如下
[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. ;curl.cainfo =
将之前下载的cacert.pem的绝对路径复制到 ----> curl.cainfo="cacert.pem绝对路径", 例如: E:projectmy_testcurl_cainfocacert.pem 然后去掉注释, 重启PHPstudy.
以上是关于...cURL error 60: SSL certificate problem: unable to get local issuer certificate...的主要内容,如果未能解决你的问题,请参考以下文章
...cURL error 60: SSL certificate problem: unable to get local issuer certificate...
cURL error 60: SSL certificate problem: unable to get local issuer certificate(转)亲测
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx
facebook auth cURL 错误 60:SSL 证书
cURL error 60: SSL certificate problem: unable to get local issuer certifica
Not hacking CurlException: 60 (cURL SSL Certificate Verification)