致命错误:未捕获的异常“ParseParseException",消息为“SSL 证书问题:无法获得本地颁发者证书"

2021-12-30 00:00:00 ssl php parse-platform

这是我第一次使用 parse.com php SDK 并尝试执行以下代码

This is the first time I use parse.com php SDK and I try to execute the following code

<?php require '../autoload.php'; 
use ParseParseObject;
use ParseParseClient;
ParseClient::initialize( "Zsr...", "BzM..", "D..." );
$gameScore = new ParseObject("GameScore");
$gameScore->set("score", 1337);
$gameScore->set("playerName", "Sean Plott");
$gameScore->set("cheatMode", false);

try {
        $gameScore->save();
         echo 'New object created with objectId: ' . $gameScore->getObjectId();
        } catch (ParseException $ex) { 
          // Execute any logic that should take place if the save fails.
          // error is a ParseException object with an error code and message.
          echo 'Failed to create new object, with error message: ' + $ex->getMessage();
    }
?>

但是我得到那个错误

 Fatal error: Uncaught exception 'ParseParseException' with message 'SSL certificate problem: unable to get local issuer certificate' in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php:250 Stack trace: #0 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(925): ParseParseClient::_request('POST', '/1/classes/Game...', NULL, '{"score":1337,"...', false) #1 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(836): ParseParseObject::deepSave(Object(ParseParseObject), false) #2 /opt/lampp/htdocs/parse/src/hola.php(11): ParseParseObject->save() #3 {main} thrown in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php on line 250

代码是教程代码,我没有改过任何东西有人知道是什么问题吗?

The code it's the tutorial code, iI haven't changed anything anyone knows what's the problem?

推荐答案

我也遇到了同样的问题.现在我解决了使用其他论坛的答案.

I am also getting same issue. Now I resolve using some other forums answer.

打开你的 ParseClient.php 并找到:

Open your ParseClient.php and find:

curl_init();

然后添加行添加:

curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, false);

它会起作用.

相关文章