Google PHP API客户端:CA cert错误

myk*_*ool 12 php curl google-api

我正在尝试与Google PHP API客户端进行交互,我遇到了Google提供的证书问题:

谷歌错误:

SSL certificate problem, verify that the CA cert is OK.
Retrying with the CA cert bundle from google-api-php-client. 
Run Code Online (Sandbox Code Playgroud)

PHP cURL错误:

SSL certificate problem: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud)

我在Linux机器上没有任何问题.这些错误发生在Windows机器上.

我尝试了几种不同的解决方案:

https://code.google.com/
http://richardwarrender.com/

但无济于事.

PS:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
Run Code Online (Sandbox Code Playgroud)

是不可接受的......

Mik*_*e T 26

礼貌rmckay在webaware dot com dot au:

请大家,停止将CURLOPT_SSL_VERIFYPEER设置为false或0.如果您的PHP安装没有最新的CA根证书包,请在curl网站下载并将其保存在您的服务器上:

http://curl.haxx.se/docs/caextract.html

然后在php.ini文件中设置它的路径,例如在Windows上:

curl.cainfo=c:\php\cacert.pem
Run Code Online (Sandbox Code Playgroud)

关闭CURLOPT_SSL_VERIFYPEER允许中间人(MITM)攻击,你不需要!