I have a PHP script that posts content on Facebook page of an user. This works through a Facebook app.
When I click Authorize, it loads for 10 seconds, it doesn't post and it shows a blank page with the following error:
exception Failed to connect to 2a03:2880:f01f:2:face:b00c:0:2: Network is unreachable Fatal error: Call to a member function getLongLivedSession() on a non-object in /var/zpanel/hostdata/zadmin/public_html/mysite/thirdparty/networks/facebook/Facebook.php on line 92
Everything worked perfectly until a week ago, but today I continue to get that error. What is the cause of this problem?
Many servers have IPv6 enabled but it’s not routed and it doesn’t actually work. This turns into a major issue when you are trying to access a site which is IPv6 ready. By default, curl will try to connect via IPv6 and will timeout. Via IPv4 it could work just fine, only if you add this:
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
If you encounter this problem with file_get_contents()
, get_headers()
, etc. you can add the following lines in /etc/sysctl.conf
:
#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Or
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
Disable ipv6 in freebsd 9
/etc/rc.conf
ipv6_network_interfaces="none" # Default is auto
ipv6_activate_all_interfaces="NO" # this is the default
ip6addrctl_enable="NO" # New way to disable IPv6 support
ip6addrctl_policy="ipv4_prefer" # Use IPv4 instead of IPv6
ipv6_activate_all_interfaces="NO" # Do not automatically add IPv6 addresses
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With