【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
curl 出现错误代码60 ,77
开发日记:aws emr api 接口开发
Today I was trying to consume an external video API for streaming a set of videos; so I got the code for the PHP source, create all my configuration but when I tried to get the actual data from the external server via cURL; I was obtaining nothing; so, in order to get the error’s message, this is what I did:
var_dump(curl_error($ch));
Which basically gets the error after the connection. The message was the following one:
SSL certificate problem: unable to get local issuer certificate
The solution
1) Download the certificate from http://curl.haxx.se/ca/cacert.pem
2) Create a folder under your home:
mkdir /Users/alex/ssl
3) Copy or move the file with the certificate you just downloaded:
mv /Users/alex/Downloads/cacert.pem /Users/alex/ssl
4) Open your php.ini and look for this directive curl.cainfo (the path should vary, depending on your system or meta-package you are using: WAMP, XAMPP, AMPPS have different paths).
[curl]; A defaultvaluefor the CURLOPT_CAINFO option. This is required to be an; absolute path.curl.cainfo =
5) Type there you path to the certificate; for example in my case, this was the configuration I did:
curl.cainfo = /Users/alex/ssl/cacert.pem
6) Restart your Apache.
7) Enjoy!
稍后可能会有curl 77的错误:
http://curl.haxx.se/ca/cacert.pem 下载或者复制粘贴成一个cacert.pem文档
如果你的php环境是window 下,用的集成环境xamp 之类的,那么,我建议你们将那个cacert.pem放置到xampp下面,才能解决77的错误
来源:oschina
链接:https://my.oschina.net/u/613887/blog/785591