Reputation: 31
I am trying to create my first FB application and it doesn't seem to work. I am new to PHP but I have followed the instructions to the letter. I have installed the facebook client library on my server. Then I copied the example code provided by Facebook and all I get is a blank page. However, if I only include simple PHP commands such as the following, things work fine.
echo 'hello';
If I then add another command such as
require_once 'facebook.php';
I get the blank page again. But if I write the command as follows
include_once ('/facebook.php');
I still get 'hello' on the page. But this are the only parts of the code that seem to work. If I add the next few lines of the example code
$appapikey = '12345etc'; $appsecret = '12345etc'; $facebook = new Facebook($appapikey, $appsecret); $user_id = $facebook->require_login();
then I'm back at the blank page.
Upvotes: 3
Views: 222
Reputation: 166
Looks like php is not able to include your file. Require produces a fatal error where as include produces a warning, and that's why when doing include you still see the hello in your page. Anyway, you're not seeing the error or warning because displaying errors are turned off. Put this at the top of your script for development purposes:
ini_set('display_errors', '1');
ini_set('html_errors', '1');
error_reporting(-1);
Now you should see error reporting output to the page and you can debug this.
Upvotes: 2