php Facebook SDK名称空间错误

I am trying to get the new facebook php sdk setup on my site. I'm running the latest stable version of php. I have never messed with namespaces before. Can someone tell me what I'm doing wrong?

I get this error

Fatal error: Class 'FacebookSession' not found in

When I run this code

FacebookSession::setDefaultApplication( 'xxx','yyy' );

.....

// path of these files have changes
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/HttpClients/FacebookHttpable.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/HttpClients/FacebookCurl.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/HttpClients/FacebookCurlHttpClient.php' );

// other files remain the same
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookSession.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookRedirectLoginHelper.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookRequest.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookResponse.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookSDKException.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookRequestException.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookOtherException.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/FacebookAuthorizationException.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/GraphObject.php' );
require_once( '/var/www/vhosts/server/site/lib/fb/Facebook/GraphSessionInfo.php' );

// path of these files have changes
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;

Problem was due to PEAR being installed on the server for email. The include path in php settings was modified.

I actually removed PEAR, set PHP back to it's default include path and switched email to swiftmailer.

You don't need to use the full path to the Facebook SDK unless you are trying to access it from a totally different location. You should be able to access it using a relative path, like lib/fb/Facebook/GraphSessionInfo.php, assuming your index.php file is located in the site folder.

Also, try doing the following and see if you still get an error:

Facebook\FacebookSession::setDefaultApplication( 'xxx','yyy' );