title: Facebook error: "Fatal error: Class 'Facebook' not found"
body: <p>I keep getting the following error:</p>
  
  <pre><code>Fatal error: Class 'Facebook' not found in /path/to/a/script/fbpostapp.php on line 14
  </code></pre>
  
  <p>I have read other Stackoverflow posts and they do not help.  The path to my FB SDK is correct.  I am using version 5.0 of the FB SDK (the latest)</p>
  
  <p>I have included both Facebook.php and autoload.php and also tried each require_once for each file separately, same error.  No other errors are provided.</p>
  
  <p>I am not sure what I am doing wrong.  Please help</p>
  
  <pre><code>&lt;?php
  // require Facebook PHP SDK
  // see: https://developers.facebook.com/docs/php/gettingstarted/
  // require_once("/YOUR_PATH_TO/facebook_php_sdk/facebook.php");
  require_once 'php-graph-sdk-5.0.0/src/Facebook/Facebook.php';
  require_once 'php-graph-sdk-5.0.0/src/Facebook/autoload.php';
  // initialize Facebook class using your own Facebook App credentials
  // see: https://developers.facebook.com/docs/php/gettingstarted/#install
  $config = array();
  $config['appId'] = '***';
  $config['secret'] = '***';
  $config['fileUpload'] = false; // optional
  
  $fb = new Facebook($config);
  
  // define your POST parameters (replace with your own values)
  $params = array(
   "access_token" =&gt; "YOUR_ACCESS_TOKEN", // see:     https://developers.facebook.com/docs/facebook-login/access-tokens/
    "message" =&gt; "Here is a blog post about auto posting on Facebook using PHP #php #facebook",
    "link" =&gt; "http://www.pontikis.net/blog/auto_post_on_facebook_with_php",
    "picture" =&gt; "http://i.imgur.com/lHkOsiH.png",
    "name" =&gt; "How to Auto Post on Facebook with PHP",
    "caption" =&gt; "www.pontikis.net",
    "description" =&gt; "Automatically post on Facebook with PHP using Facebook PHP SDK. How to create a Facebook app. Obtain and extend Facebook access tokens. Cron automation."
  );
  
  // post to Facebook
  // see: https://developers.facebook.com/docs/reference/php/facebook-api/
  try {
    $ret = $fb-&gt;api('/YOUR_FACEBOOK_ID/feed', 'POST', $params);
    echo 'Successfully posted to Facebook';
  } catch(Exception $e) {
     echo $e-&gt;getMessage();
  }
  ?&gt;
  </code></pre>