|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-09-10 22:18 UTC] neon at neon-line dot net
Description:
------------
Unable to connect to IPv6 addresses or hostnames pointing to an IPv6 address, even though IPv6 is properly configured.
PHP has been configured with --enable-ipv6 option and phpinfo shows that it is indeed enabled.
I checked with telnet utility that these hosts respond and with that they did.
Reproduce code:
---------------
fsockopen("[::1]",80);
echo "--\n";
fsockopen("[fe80:1:1::1]",80);
echo "--\n";
fsockopen("fe80:1:1::1",80);
echo "--\n";
fsockopen("ipv6.host.name",80);
Expected result:
----------------
--
--
--
Actual result:
--------------
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [::1]:80 (Unknown error)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [fe80:1:1::1]:80 (Unknown error)
--
Warning: fsockopen(): unable to connect to fe80:1:1::1:80 (Operation timed out)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to ipv6.host.name:80 (Unknown error)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 08:00:02 2025 UTC |
Do any of these work? fsockopen('tcp://::1', 80); fsockopen('tcp://[::1]', 80); stream_socket_client('tcp://[::1]:80');Please try manually compiling this (slightly altered code from configure.in), running it, and pasting the output here in this bug report; thanks! 1/ Copy the code into v6test.c 2/ cc -o v6test v6test.c 3/ ./v6test #include <netdb.h> #include <sys/types.h> int main(void) { struct addrinfo *ai, *pai, hints; memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) { printf("FAIL-1\n"); exit(1); } if (ai == NULL) { printf("FAIL-2\n"); exit(1); } pai = ai; while (pai) { if (pai->ai_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ printf("FAIL-3\n"); exit(1); } if (pai->ai_addr->sa_family != AF_INET) { /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ printf("FAIL-4\n"); exit(1); } pai = pai->ai_next; } freeaddrinfo(ai); printf("OK!\n"); exit(0); }