Title: Facebook PHP SDK and WordPress Plugin
Last modified: August 21, 2016

---

# Facebook PHP SDK and WordPress Plugin

 *  [robbiegod](https://wordpress.org/support/users/robbiegod/)
 * (@robbiegod)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/facebook-php-sdk-and-wordpress-plugin/)
 * I’m writing a plugin that uses the Facebook PHP SDK. I am using the latest version
   which i downloaded from github.
 * I’m trying to include it in my plugin, but when i run the function that grabs
   my public feed I am getting “header” errors.
 * Here are the errors I am getting:
 * Warning: session_start() [function.session-start]: Cannot send session cookie–
   headers already sent by (output started at {path_to}/wp-admin/includes/template.
   php:1698) in {path_to}/wp-content/plugins/{plugin_name}/facebook-php-sdk-master/
   src/facebook.php on line 48
 * And very similar error for “Cannot send session cache limiter”.
 * I’ve done some searches in google and bing and turned up something about using
   ob_start() and ob_end_flush(). I’ve tried the ob_start at the beginning of my
   plugin file and ob_end_flush at the end of the file. It doesn’t seem to do anything.
   I’ve tried putting ob_start in multiple places (inside the primary function, 
   outside of the primary function, inside of the facebook.php, inside the base_facebook.
   php, etc.) None of those options worked really.
 * I’ve also read that there is a different flavor of the Facebook SDK that Facebook
   uses in the official Facebook plugin.
 * Do i have to install the Facebook plugin and use its SDK and then require my 
   users to install the Facebook plugin in order to use my plugin. God i hope not.
   I don’t want to have additional resources required. I would prefer to have the
   plugin self contained.
 * If someone can offer some guidance that would be awesome!
 * *UPDATE* – I also tried setting my servers /tmp folder to get the errors to disappear,
   but no luck. I read that that would work.
 * Lastly, I also have WP DEBUG in my wp config file enable so that i can see any
   errors that pop-up.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [robbiegod](https://wordpress.org/support/users/robbiegod/)
 * (@robbiegod)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/facebook-php-sdk-and-wordpress-plugin/#post-4406624)
 * UPDATE #2 – I’ve also tried taking the Facebook PHP SDK from the facebook plugin.
   This worked better, but still its a no go because i am getting a different error.
 * The error i get when i use the facebook php sdk from the facebook plugin is:
 * Fatal error: Access to undeclared static property: WP_BaseFacebook::$CURL_OPTS
   in {path}/wp-content/plugins/{pluginname}/facebook-php-sdk/src/base_facebook.
   php on line 932
 * How can i fix this error?
 *  [7fatcat](https://wordpress.org/support/users/7fatcat/)
 * (@7fatcat)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/facebook-php-sdk-and-wordpress-plugin/#post-4406774)
 * if u had the answer, please do let us know. i had the same question as u. T_T.
   thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Facebook PHP SDK and WordPress Plugin’ is closed to new replies.

## Tags

 * [facebook sdk](https://wordpress.org/support/topic-tag/facebook-sdk/)

 * 2 replies
 * 2 participants
 * Last reply from: [7fatcat](https://wordpress.org/support/users/7fatcat/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/facebook-php-sdk-and-wordpress-plugin/#post-4406774)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
