What is the reason for this Facebook error: "An error occurred while testing PHP SDK modules"?

I work with Facebook on my site and look at this example: https://github.com/facebook/php-sdk/blob/master/examples/example.php

When I find "Login with Facebook" on the example site, I get an error message:

An error occurred with PHP SDK Unit Tests. Please try again later. 

Any ideas why this will happen?

+4
source share
2 answers

It is likely that your local host has problems with external servers.

0
source

I encountered the same error earlier (now resolved). The error I made was calling the Facebook API using the old ie method

 $appid = 'xxx'; $secret = 'xxxxxxxx'; $fb = new Facebook($appid, $secret); $user = $fb->getUser(); 

Here the $ fb instance itself was wrong. I checked it by installing

 if ($appid == $fb->geAppId()) 

TO FIX IT Uses New API Method

 $appid = 'xxxxxxxx'; // your APP ID $appsecret = 'xxxxxxxxxx'; // your APP sceret. $config = array( 'appId'=> $appid, // IMP: note that it is 'appId' and not 'appid'. 'secret' => $appsecret ); $fb = new Facebook($config); printf("<br/> FaceBook AppId Test : %s",(($fb->getAppId() == $appid)?"PASSED":"FAILED")); printf("<br/> FaceBook Secret Test : %s",(($fb->getApiSecret() == $appsecret)?"PASSED":"FAILED")); 

The above two printfs are for testing purposes only if the $ fb file itself was created correctly or not. You might want to remove them in your application.

+1
source

All Articles