Facebook getuser在PHP SDK中返回500内部错误


Facebook getuser return 500 internal error in PHP SDK

我有这种类型的问题,我使用PHP SDK的最新版本,从三月我的应用程序停止时,我必须完成登录。我已经上传了最新版本但是现在php执行

$user = $facebook->getUser();

我得到错误500内部等等等等。我已经尝试了一切,但现在我不知道是什么问题,我也尝试了Facebook PHP SDK 500 -内部服务器错误

,但我只得到内部错误。如果有人能帮我。代码如下

<?php
    require 'src/facebook.php';
    $facebook = new Facebook(array(
      'appId'  => 'fdsafdasfdasfdsafas8',
      'secret' => 'dasgasgasgasgas',
    ));
    // See if there is a user from a cookie
    $user = $facebook->getUser();
    if ($user) {
      try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
        $user = null;
      }
    }
    ?>
    <!DOCTYPE html>
    <html xmlns:fb="http://www.facebook.com/2008/fbml">
      <body>
        <?php if ($user) { ?>
          Your user profile is
          <pre>
            <?php print htmlspecialchars(print_r($user_profile, true)) ?>
          </pre>
        <?php } else { ?>
          <fb:login-button></fb:login-button>
        <?php } ?>
        <div id="fb-root"></div>
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId: '<?php echo $facebook->getAppID() ?>',
              cookie: true,
              xfbml: true,
              oauth: true
            });
            FB.Event.subscribe('auth.login', function(response) {
              window.location.reload();
            });
            FB.Event.subscribe('auth.logout', function(response) {
              window.location.reload();
            });
          };
          (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
              '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
          }());
        </script>
      </body>
    </html>

您可能需要启用ssl库,您还可以检查Apache日志中的错误