I have tested my login script on my localhost with no problems.
I have now uploaded it online as can be seen at this link
Obviously if you click, you can see that a blank page is displayed and I have no idea why.
I did a test of a little bit of content, and removed the Facebook SDK code.
//Facebook config (required for library)
$fb_config = array(
'appId' => 'REMOVED',
'secret' => 'REMOVED'
);
//Load Facebook library
$this->load->library('facebook', $fb_config);
//SET FACEBOOK USER
$fbuser = array();
$fbuser = $this->facebook->getUser();
When the above code is not present, the page loads.
I have updated my app setting correctly, namely changing the site URL fro http://localhost
to http://gua.com so i dont believe it is that.
I have even changed my CI settings to show all errors - nothing is shown.
Does anyone have any suggestions as to why the above code might be making a blank page load ONLY when it is hosted online?
Many Thanks
THomas
Open up the base_facebook.php and try removing either of these two lines from the top.
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new Exception('Facebook needs the JSON PHP extension.');
}
If you stop getting the white screen, it should indicate that your sever needs either curl or json_decode enabled.
Alternatively you could just do a echo phpinfo()
and check if they are enabled. Note that json_decode/encode is only available in php >=5.2
If your localhost was a Windows box and your remote host is a *NIX system, there is a chance that some extra white space was introduced into your SDK files outside of the <?php ?>
tags. This can sometimes cause the "white screen of death" when this whitespace is output and sets the headers.
Try downloading a fresh copy of the SDK from Github and don't unzip it until it is on your remote server. Better yet, if you ssh access wget
it or git clone
it directly there. See if that helps.
If it doesn't, add error_reporting(E_ALL)
as the first line of your script and see if that tells you anything.
You will need to run chmod eg: "sudo chmod -R 777 facebook/". I think the files were written in or for windows so on a *Nix system it does not run till that is checked.
In my case after doing this, I started to have errors I could work with.