使用捆绑的信息无效或未找到证书颁发机构 [英] Invalid or no certificate authority found, using bundled information

查看:71
本文介绍了使用捆绑的信息无效或未找到证书颁发机构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始使用Facebook API. 我从Facebook下载了示例代码,并配置了我的appID和秘密密钥.

I'm getting started with the facebook API. I downloaded the example code from facebook, configured with my appID and secret keys.

<?php
   require '../src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => '...',
  'secret' => '....',
));

// Get User ID
$user = $facebook->getUser();

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl();
}

// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');

?>

在本地主机上,脚本可以正常工作.但是在主机上,我收到以下错误:

on localhost,the script work with no errors. But on host I getting the following error:

使用捆绑信息发现无效或找不到证书颁发机构

Invalid or no certificate authority found, using bundled information

.crt 文件已成功上传

可能会指出我的错误? 提前致谢.

one may point out my error? thanks in advance.

推荐答案

在CURL中设置选项以指向您的证书文件

此选项将告诉CURL您的fb_ca_chain_bundle.crt文件与脚本位于同一文件夹中.

This option will tell CURL that your fb_ca_chain_bundle.crt file is in the same folder as your script.

Facebook::$CURL_OPTS[CURLOPT_CAINFO] = getcwd().'/fb_ca_chain_bundle.crt';

在base_facebook.php行844 curl_exec失败,并生成错误.然后脚本设置:

In base_facebook.php line 844 curl_exec fails and the error is generated. Then the script sets:

curl_setopt($ch, CURLOPT_CAINFO,
              dirname(__FILE__) . '/fb_ca_chain_bundle.crt');

然后重试.

第二次一切都很好,没问题,只会弄乱您的日志

The Second time all is well, there is no problem it just makes a mess of your log

请勿使用

Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;

否则中间人将能够拦截您的呼叫!

Or a man-in-middle will be able to intercept your call!

这篇关于使用捆绑的信息无效或未找到证书颁发机构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆