Question

Im trying to upload an image to a group using the Php SDK but it keeps returning this error "Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server".

        $access_token = $facebook->getAccessToken();

        $output = "";
        $facebook->setFileUploadSupport(true);
        $group_id = "390114434403182";
        //Upload a photo
        $photo_details = array(
            'message' => 'Screen Shot'
        );
        //Absolute url
        $file='https://aplikoj.com/fbapps/turbopost2/images/ID-10059064.jpg';
        $photo_details['image'] = '@' . realpath($file);
        //Do the upload and get the responses
        $upload_photo = $facebook->api('/'.$group_id.'/photos', 'post', $photo_details);
Was it helpful?

Solution

Checking the source code, we see that this error occurs when curl returns the error Network is unreachable when trying to make an IPv6 connection to Facebook.

This has two general causes:

  1. Your server has been configured with a global IPv6 address but doesn't actually have functional IPv6 connectivity.

    This is the most common case, thus the error message is written this way. As you can also see, the code retries the connection forcing IPv4, so you should only see this in the error log, but still get a valid result back from Facebook.

    This can be caused by having inappropriate configuration for 6to4, Teredo or ISATAP on your server, (all of which should be disabled) or by a misconfigured router advertising IPv6 addresses when IPv6 routing is not available. You should easily be able to check your server's configuration, or contact its administrator to do so.

    If you don't actually get a result back from Facebook, then you move on to...

  2. Your outgoing IPv4 connectivity is broken or firewalled.

    This is generally very rare, but it may be the case if you're working in a large corporate environment; some such places like to indiscriminately block Facebook and other such sites. You may see the spurious IPv6 error and still get a FacebookApiException of type CurlException after it retries via IPv4. If this is the case you'll need to contact the network administrator to have the restriction removed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top