title: Facebook PHP SDK exception error
body: <p>I am getting an interesting SDK exception message from FB's PHP SDK. I set up my code exactly as the FB docs say to do..?</p>
  
  <p>DEBUG ERROR MESSAGE:</p>
  
  <pre><code>[12-Jun-2014 21:08:12 UTC] PHP Fatal error:  Uncaught exception 'Facebook\FacebookSDKException' with message 'Session not active, could not store state.' in C:\WebRoot\Website\root\inc\Facebook\FacebookRedirectLoginHelper.php:188
  Stack trace:
  #0 C:\WebRoot\Website\root\inc\Facebook\FacebookRedirectLoginHelper.php(94):Facebook\FacebookRedirectLoginHelper-&gt;storeState('**********...')
  #1 C:\WebRoot\Website\root\login\index.php(87): Facebook\FacebookRedirectLoginHelper-&gt;getLoginUrl()
  #2 {main}
     thrown in C:\WebRoot\Website\root\inc\Facebook\FacebookRedirectLoginHelper.php on line 188
  </code></pre>
  
  <p>Facebook.php:</p>
  
  <pre><code>&lt;?php
  require_once("../inc/config.php");
  require_once(ROOT_PATH . 'inc/Facebook/FacebookSession.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookRedirectLoginHelper.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookRequest.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookResponse.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookSDKException.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookRequestException.php' );
  require_once(ROOT_PATH . 'inc/Facebook/FacebookAuthorizationException.php' );
  require_once(ROOT_PATH . 'inc/Facebook/GraphObject.php' );
  require_once(ROOT_PATH . 'inc/Facebook/HttpClients/FacebookCurl.php' );
  require_once(ROOT_PATH . 'inc/Facebook/HttpClients/FacebookHttpable.php' );
  require_once(ROOT_PATH . 'inc/Facebook/HttpClients/FacebookCurlHttpClient.php' );
  
  use Facebook\FacebookSession;
  
  // init app with app id (APPID) and secret (SECRET)
  FacebookSession::setDefaultApplication("**********","*******************");
  </code></pre>
  
  <p>Main Login Page:    </p>
  
  <pre><code>&lt;?php
  require_once("../inc/config.php");
  require_once(ROOT_PATH . 'inc/Facebook/Facebook.php' );
  require_once(ROOT_PATH . "inc/LoginHelper.php");
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  use Facebook\FacebookResponse;
  use Facebook\FacebookSDKException;
  use Facebook\FacebookRequestException;
  use Facebook\FacebookAuthorizationException;
  use Facebook\GraphObject;
  use Facebook\HttpClients\FacebookCurl;
  use Facebook\HttpClients\FacebookHttpable;
  use Facebook\HttpClients\FacebookCurlHttpClient;
  
  session_start();
  
  // login helper with redirect_uri
  $helper = new FacebookRedirectLoginHelper( '***********' );
  </code></pre>
  
  <p>Link on main login page:</p>
  
  <pre><code>&lt;a href="&lt;?php echo $helper-&gt;getLoginUrl();?&gt;"&gt;&lt;img src="&lt;?php echo BASE_URL; ?&gt;img/facebook-login-button.png" class="fb-login"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Redirect url page:</p>
  
  <pre><code>&lt;?php
  require_once("../inc/config.php");
  require_once(ROOT_PATH . 'inc/Facebook/Facebook.php' );
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  use Facebook\FacebookResponse;
  use Facebook\FacebookSDKException;
  use Facebook\FacebookRequestException;
  use Facebook\FacebookAuthorizationException;
  use Facebook\GraphObject;
  use Facebook\HttpClients\FacebookCurl;
  use Facebook\HttpClients\FacebookHttpable;
  use Facebook\HttpClients\FacebookCurlHttpClient;
  
  session_start();
  
  //get user login token from FB
  $helper = new FacebookRedirectLoginHelper('*******');
  try {
     $session = $helper-&gt;getSessionFromRedirect();
  } catch(FacebookRequestException $ex) {
       echo $ex;
    // When Facebook returns an error
  } catch(Exception $ex) {
      echo $ex;
    // When validation fails or other local issues
  }
  if ($session) {
      $FacebookAccessToken = $session-&gt;getToken();
     // Logged in
  }
  </code></pre>