ID:               27509
 User updated by:  scott at abcoa dot com
 Reported By:      scott at abcoa dot com
 Status:           Open
 Bug Type:         Sockets related
 Operating System: AIX 4.3.3
 PHP Version:      4.3.4
 New Comment:

Is it still possible for me to use the ipv6 enabled later on?


Previous Comments:
------------------------------------------------------------------------

[2004-03-11 17:42:23] scott at abcoa dot com

With the latest CVS tarball and the configure line, "./configure
--disable-ipv6".  After configuring and before the make compilation. 
The main/php_config.h showed ...



--snip--

/* Whether to enable IPv6 support */

/* #undef HAVE_IPV6 */

--snip--



So far, so good.  Again, checking for ...



--snip--

/* Define if you have the getaddrinfo function */

#define HAVE_GETADDRINFO 1

--snip--



So, it is already defined as you expected.  So, replacing it with "/*
#define HAVE_GETADDRINFO 1 */".



Then on to make and installing.  So far, so good.  Then ran the
fsockopen() test..  The result look good..



--snip--

Content-type: text/html

X-Powered-By: PHP/4.3.5RC4-dev



!#/usr/local/bin/php



0

--snip--



Then tested with the "Example 1. fsockopen() Example" from
http://us3.php.net/manual/en/function.fsockopen.php and it work like a
charm.



Let me know when the fix is made and get checked into the CVS for 4.3.4
build/branch and for 5.0 build/branch.  I'll be happy to do a few more
testing if you need me to.

------------------------------------------------------------------------

[2004-03-11 15:40:28] [EMAIL PROTECTED]

That's..... I think "messed up" is the technical term.



I see two major problems here.



1) hints.ai_family is being reset by code that should be excluded by
having used the --disable-ipv6 switch.



2) getaddrinfo() is returning a structure that, while it contains a
top-level field insisting it's an AF_INET address.  Contains a sockaddr
child structure with an ai_family of PF_UNSPEC.  So when
php_hostconenect gets it, it tries creating a socket with an
"unspecified" address family.  No wonder it's unsupported eh?



Let's go down this road:  



First, undo that patch, download a new tarball if necessary.  Heck,
might as well grab the latest CVS snapshot.  Though if you reuse your
current tree with a restored main/network.c you'll need to be sure and
run `make clean`.



Next, run a normal ./configure with the --disable-ipv6 switch.



Now, BEFORE running make, edit main/php_config.h and check that
HAVE_IPV6 is in fact, not defined.  If it is defined, comment it out
(And let us know in your feedback).



Next, look for HAVE_GETADDRINFO in the same file.  Make sure it is also
undefined. (I expect that it will be defined, so you'll need to comment
it out)



Finally, run make, and try out the fsockopen test.





------------------------------------------------------------------------

[2004-03-11 13:55:26] scott at abcoa dot com

Here's the response I got...  It's also the same with the host,
"www.example.com" instead of "www.google.com".



--snip--

Content-type: text/html

X-Powered-By: PHP/4.3.5RC4-dev



!#/usr/local/bin/php



getaddresses

  GETADDRINFO method

  defaulting to AF_INET(2)  hints.ai_family = 0

  got result

    sai->ai_family = 2

  returning from getaddresses: n = 1

php_network_getaddresses returned 1

Creating socket of type 0 (AF_INET = 2)

  socket() returned: -1

<br />

<b>Warning</b>:  fsockopen(): unable to connect to www.google.com:80 in
<b>/home/website/emarket/test_fsockopen_shell.sh</b> on line
<b>6</b><br />



66



Addr family not supported by protocol

--snip--

------------------------------------------------------------------------

[2004-03-11 13:12:03] [EMAIL PROTECTED]

Sorry, I wanted you to run a test with fsockopen(), not the socket_*
extension.  (Believe it or not they're completely different
implementations even though they do the same thing)



<?php

  $fp = fsockopen('www.exmaple.com', 80);

?>



Please run that one against the version you've already patched and
compiled.

------------------------------------------------------------------------

[2004-03-11 10:54:40] scott at abcoa dot com

Not a  problem!  Been wanting the fsockopen() to work, so my company's
website can function once again.  



Applied the patch and went through the programmer's ritual (compiling)
all over again.  Out came the result, believe it or not, it's the same
end result.   



--snip--

Content-type: text/html

X-Powered-By: PHP/4.3.5RC4-dev



!#/usr/local/bin/php



resource(1) of type (Socket)

bool(true)

resource(2) of type (Socket)

bool(true)

--snip--



Look like the four functions, "php_host_connect(***)", 

"php_network_getaddress(***)", "php_connect_nonb(***)" and 

"dump_stock_state(***)" wasn't reached and executed.



I did open up the network.c and 27509-diff.txt with the editor and
check to see if the patch was applied correctly and I can confirm that
the patch was insteed applied.  :-(

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/27509

-- 
Edit this bug report at http://bugs.php.net/?id=27509&edit=1

Reply via email to