Curl Error: How can I re-enable it?(Facebook Auth)

Curl Error: How can I re-enable it?(Facebook Auth)

虽然 运行 代码在本地主机上运行完美,但在服务器上运行时它不会重定向,成功登录 Facebook 后重定向不起作用。

服务器PHP5.4.x
Facebook PHP SDK v4

1. PHP Warning:  curl_exec() has been disabled for security reasons in /src/Facebook/HttpClients/FacebookCurl.php on line 77
2. PHP Catchable fatal error:  Argument 4 passed to Facebook\FacebookResponse::__construct() must be of the type array, null given, called in src/Facebook/FacebookClient.php on line 225 and defined in /src/Facebook/FacebookResponse.php on line 75

源代码 fbconfig.php

 <?php
    require_once 'src/Facebook/autoload.php';
    use Facebook\Facebook;
    use Facebook\FacebookResponse; 
    use Facebook\GraphNodes\GraphUser;
    use Facebook\Exceptions\FacebookAuthenticationException;
    use Facebook\Exceptions\FacebookSDKException;
    use Facebook\Exceptions\FacebookResponseException;
    use Facebook\Helpers\FacebookRedirectLoginHelper;
    use Facebook\FacebookClient;
    use Facebook\HttpClients\FacebookHttpClientInterface;
    session_start();
    $fb = new Facebook(['app_id' => 'xx',
      'app_secret' => 'yy',
      'default_graph_version' => 'v2.2',
      ]);
    $helper = $fb->getRedirectLoginHelper();
    try {
      $accessToken = (string)($helper->getAccessToken());
    } catch(Facebook\Exceptions\FacebookResponseException $e) {
      // When Graph returns an error
      echo 'Graph returned an error: ' . $e->getMessage();
      exit;
    } catch(Facebook\Exceptions\FacebookSDKException $e) {
      // When validation fails or other local issues
      echo 'Facebook SDK returned an error: ' . $e->getMessage();
      exit;
    }
    echo $accessToken;
    if (isset ($accessToken))
    {
    $fb->setDefaultAccessToken($accessToken);
    try {
      // Returns a `Facebook\FacebookResponse` object
        $response = $fb->get('/me');
        $user = $response->getGraphUser();
    }
    catch(Facebook\Exceptions\FacebookResponseException $e) {
        echo 'Graph returned an error: ' . $e->getMessage();
        exit;
    } catch(Facebook\Exceptions\FacebookSDKException $e) {
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        exit;
    }
        $_SESSION['FULLNAME']=$user['name'];
        $_SESSION['FBID']= $user['id'];
        header("Location: index.php");
    }
    else
    {
        $permissions = ['email']; // optional
        $loginUrl = $helper->getLoginUrl("http://x.com/fbconfig.php",$permissions);//,$permissions);
        header("Location: ".$loginUrl);
    }
    ?>

如何在服务器中启用 curl_exec()?这是什么 curl_exec()

如警告所述,curl_exec() 已禁用。 Curl 用于与 facebook 通信并且是必需的,因此请确保您或您的托管服务提供商启用它。