ID:               11058
 Comment by:       forums at vertdeterre dot com
 Reported By:      pat at mail dot rit dot edu
 Status:           Bogus
 Bug Type:         Network related
 Operating System: OpenBSD 2.6
 PHP Version:      4.0.6
 New Comment:

fsockopen doesn't support http:// in the url name, first parameter of
the fonction.
for example 
$url = "www.google.com";  
$fp = fsockopen($url, 80, $errno, $errstr, 30); 
return TRUE while
$url = "http://www.google.com";;  
$fp = fsockopen($url, 80, $errno, $errstr, 30); 
return php_network_getaddresses: getaddrinfo failed: Name or service
not known 

regards


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

[2004-08-21 14:38:39] webmaster at hg-carstyling dot de

ages later, i found a solution, what solves it for me here.
the problem seems to base on the name resolution for the remote
machine.

a typical error while opening a remote file was:
----
 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
Name or service not known in
/home/carstyling/public_html/newnuke/modules/WebMail/pop3.php on line
70

Warning: fsockopen(): unable to connect to mx.freenet.de:110 in
/home/carstyling/public_html/newnuke/modules/WebMail/pop3.php on line
70
----
i tryed to reconfigure my named configuration, without any result, to
fix this.
the problem was solved by adding the following line to my /etc/hosts:

194.97.55.147      mx.freenet.de

i have to do this for any remote machine i like to open files on. 
this is NOT the basic of that problem, but patches arround that. i was
not able, to tell my named, to resolv that adress to that ip, so i have
to enter that in /etc/hosts .

it seems, the problem is the name-resolution domain to ip, as it was
discribed already here and on other sources before.

over that, it is not a problem of all your php-scripts, you`ve written
and were the error comes. just enter the unknown machine to your hosts
file and all went fine.

i tryed many different configurations of my bind, but was not able, to
resolve other top level domains within a full qualified domain name so
i feel to say its a bug in bind by isc, but this can also be a security
relatet problem.

i am open for mail and requests and i am very interrested on the basic
solution.

regardz :)

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

[2004-08-16 01:40:43] hachem at phptunisia dot com

restart the bind

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

[2004-07-14 22:29:05] neil dot giarratana at lucidus dot net

Don't know if this helps at all but on RH9, if I do a "service network
restart", all is well again and I don't get that error anymore. Beats
the heck out of restarting the whole server

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

[2004-06-30 18:17:09] webmaster at hg-carstyling dot de

i have that problem, too, on 4 machines running RH9, FC1 and FC2. I
spend some whole days to solve it, but cannot get the basic of this
problem.

On 1 machine i have serveral virt. domains, were i enter the hostnames
of 2 domains in /etc/hosts, what results in a fix on one domain,
another domain on the same machine was not affected and the error stays
as bevor.

I Tryed out, to fix my /var/named/my.stupid.zone, were i found a
missconfiguration by redhat-config-bind. I fix the config, checked my
nameserver out and hes runnin fine with no errors, but the getadress
error stays as bevor and was not affected. I am not really sure, if my
dns is perfectly configured, but i get no errors there and funcionality
is given, expecting the getadress error by php.

Over that, i cannot see anybody, who has full fixed this problem , so
its a discussion worth, but where ?!

I thing, it makes sense, if the Developers, that does or maintain the
filesocket functions of php, has a deeper look in this Problem, even if
its not php based, but they will have a clear overview, of what happened
and maybe they can give us a hint. What about the sockets ?

I thing, it is any incompatibility btw. named and the network classes
of php, especaially php mail and file network structures or classes,
maybe sockets ?!

On RH8 there are no such errors. In any case, this costs lotsa time :(
...

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

[2004-06-10 14:40:34] austinputman at hotmail dot com

I had the same problem as pat at mail dot rit dot edu using
fsockopen().

He/she uses:

fsockopen("http://www.php.net/";, 80, &$errno, &$errstr, 30);

But you shouldn't use 'http://' in the server name part. So use this
instead.

fsockopen("www.php.net", 80, &$errno, &$errstr, 30);

Maybe this will not solve everybodies problem, but it sure solved mine.

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

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/11058

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

Reply via email to