无法打开流autoload.php Facebook SDK v4

时间:2015-02-25 22:09:04

标签: php facebook facebook-php-sdk autoload

我尝试将我的应用从PHP SDK v2.0升级到最新的PHP SDK v4。我当前的PHP版本是5.4。我已将PHP SDK上传到www / games / facebook / client。我在php_error.log中收到以下消息:

 PHP Warning:  require(facebook-php-sdk-v4/autoload.php): failed to open stream: No such file or directory in /files/www/games/facebook/classes/RedSocialCore/wrappers/FacebookWrapper.php on line 16

PHP Fatal error:  require(): Failed opening required 'facebook-php-sdk-v4/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /files/www/games/facebook/classes/RedSocialCore/wrappers/FacebookWrapper.php on line 16

这是初始化:

define('FACEBOOK_SDK_V4_SRC_DIR', 'www/games/facebook/client/facebook-php-sdk-v4/src/Facebook/');
require ('facebook-php-sdk-v4/autoload.php');

use Facebook\FacebookSession;
use Facebook\FacebookJavaScriptLoginHelper;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;

我会感激任何建议

1 个答案:

答案 0 :(得分:0)

$base = $_SERVER['DOCUMENT_ROOT'];    
define('FACEBOOK_SDK_V4_SRC_DIR', $base.'/www/games/facebook/client/facebook-php-sdk-v4/src/Facebook/');
require ($base.'/www/games/facebook/client/facebook-php-sdk-v4/autoload.php');

use Facebook\FacebookSession;
use Facebook\FacebookJavaScriptLoginHelper;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;