views:

52

answers:

1

Hello, 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. Does anyone know why this is? Thanks a lot!

+1  A: 

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.

tony4d
Thanks for your answer. I tried your suggestion and here's what I get:Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /fb/facebook.php on line 38I wonder why it detects an error in the facebook.php file, since it is the standard file from the official fb client library.
Mike
Post a code snippet from that facebook file, lines 35 through 40 should be enough.
tony4d