PHP致命错误:找不到类'Facebook' [英] PHP Fatal error: Class 'Facebook' not found in

查看:139
本文介绍了PHP致命错误:找不到类'Facebook'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP致命错误:类别Facebook未找到/mnt/releases/server/asrivastava/first-task/390f5294f2b74ffbbe729e1ce9773c39573973b8/public/subscribe.php第36行

PHP Fatal error: Class 'Facebook' not found in /mnt/releases/server/asrivastava/first-task/390f5294f2b74ffbbe729e1ce9773c39573973b8/public/subscribe.php on line 36

<?php
try{
    include_once "./php-sdk/src/facebook.php";
}
catch(Exception $o){
    echo '<pre>';
    print_r($o);
    echo '</pre>';
}

error_log("Subscribe.php");
error_log("included facebook classes");
define ("FB_APPID" ,"APPID") ;
define ("FB_SECRET", "KEY");
define ("VERIFY_TOKEN" ,"myFirstFB");

$access_token = "MyAccessToken";
$user = array(
        "first_name",
        "last_name"
    ) ;
$param = array('access_token' => $access_token,
        'object' => 'user',
        'fields' => 'name, feed, likes',
     //   'callback_url' => 'http://apps.facebook.com./handleCallBack.php',
        'callback_url' => 'SomeUrl',
        'verify_token' => VERIFY_TOKEN
);
$config = array ('appId' => FB_APPID, 'secret' => FB_SECRET);
    error_log("Created FB object");
$fb = new Facebook($config);
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
error_log("made curl call");
try {

$subs = $fb->api('/'.APP_ID.'/subscriptions', 'POST', $param);
var_dump($subs);
} catch (FacebookApiException $e) {
    echo $e->getCode()." ".$e->getType()." ".$e->getMessage()." ".$e->getFile()." ".$e-                  >getLine()."\n";
}


?>

现在,当我点击这个URL时,我得到了上面提到的错误。
请客气地告诉我一个方法。

Now whenever I hit this URL I get the error metioned above. kindly suggest me a way through it please.

错误日志:

[Mon Apr 16 06:51:02 2012] [错误] [客户端172.20.2.144] Subscribe.php
[Mon Apr 16 06:51:02 2012] [错误] [客户端172.20.2.144]包括facebook类
[Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144]创建FB对象
[Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] PHP致命错误:class'Facebook'not found in /mnt/releases/server/asrivastava/first-task/390f5294f2b74ffbbe729e1ce9773c39573973b8/public/subscribe.php on line 36
[Mon Apr 16 06:51:02 2012] [error] [客户端172.20.2.144] PHP堆栈跟踪:
[Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] PHP 1. {main}()/ mnt / releases / server / asrivastava /第一任务/ 390f5294f2b74ffbbe729e1ce9773c39573973b8 / public / subscribe.php:0
[Mon Apr 16 06:51:06 2012] [error] [client 172.20.2.144]文件不存在:/ var / www / server_releases / asrivastava / first-task / flash,

[Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] Subscribe.php [Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] included facebook classes [Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] Created FB object [Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] PHP Fatal error: Class 'Facebook' not found in /mnt/releases/server/asrivastava/first-task/390f5294f2b74ffbbe729e1ce9773c39573973b8/public/subscribe.php on line 36 [Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] PHP Stack trace: [Mon Apr 16 06:51:02 2012] [error] [client 172.20.2.144] PHP 1. {main}() /mnt/releases/server/asrivastava/first-task/390f5294f2b74ffbbe729e1ce9773c39573973b8/public/subscribe.php:0 [Mon Apr 16 06:51:06 2012] [error] [client 172.20.2.144] File does not exist: /var/www/server_releases/asrivastava/first-task/flash,

推荐答案

我也有同样的问题。
这是我做错了你可能做的:

I had same problem. Here's what I did wrong that you might have done:

当我到这个页面:
https://github.com/facebook/facebook-php-sdk/tree/master/src
下载facebook.php,base_facebook.php等。

When I went to this page: https://github.com/facebook/facebook-php-sdk/tree/master/src to download facebook.php, base_facebook.php, etc.

我右键单击并且保存链接为不意识到我没有保存什么我以为我正在保存。

I right-clicked and did "Save Link As" not realizing that I wasn't saving what I thought I was saving.

解决方案:点击这些链接,然后将代码复制粘贴到facebook.php等。

SOLUTION: click those links and THEN copy and paste the code into facebook.php, etc.

这篇关于PHP致命错误:找不到类'Facebook'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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