#43687 [Com]: gethostbyname() can't return a valid ip address.
| From: | bole dot chen at gmail dot com | Date: | Wed, 08 Apr 2009 05:38:20 +0000 |
| Subject: | #43687 [Com]: gethostbyname() can't return a valid ip address. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-135652@lists.php.net to get a copy of this message | ||
ID: 43687
Comment by: bole dot chen at gmail dot com
Reported By: php at xuefeng dot org
Status: No Feedback
Bug Type: Network related
Operating System: Redhat 2.6.9-42.ELsmp #1 SMP i68
PHP Version: 5.2.5
New Comment:
I have this problem on RHEL5 too.
My sloved is "chmod 644 /etc/hosts"
Simple,but useful for me.
Previous Comments:
------------------------------------------------------------------------
[2008-02-05 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-01-28 23:54:41] tony2001@php.net
Apparently, the second DNS request fails.
You can check it out with strace/tcpdump.
------------------------------------------------------------------------
[2007-12-30 18:31:58] php at xuefeng dot org
defined via DNS entry .
------------------------------------------------------------------------
[2007-12-30 16:24:38] iliaa@php.net
Is the xxx.xxx.com domain defined via DNS entry or via a local hosts
file?
------------------------------------------------------------------------
[2007-12-27 09:29:26] php at xuefeng dot org
Description:
------------
When trying to resolv the ip address of a hostname given in /etc/hosts,
it's works fine, but does not work when trying to resolv via the DNS
server though.
btw: those test code works fine with php 5.2.1
Reproduce code:
---------------
var_dump(dns_get_record("xxx.xxx.com"));
var_dump(fsockopen("xxx.xxx.com", 80, $error, $errstr));
Expected result:
----------------
array(1) {
[0]=>
array(5) {
["host"]=>
string(12) "xxx.xxx.com"
["type"]=>
string(1) "A"
["ip"]=>
string(13) "192.168.200.6"
["class"]=>
string(2) "IN"
["ttl"]=>
int(86400)
}
}
resource(20) of type (stream)
Actual result:
--------------
array(1) {
[0]=>
array(5) {
["host"]=>
string(12) "xxx.xxx.com"
["type"]=>
string(1) "A"
["ip"]=>
string(13) "192.168.200.6"
["class"]=>
string(2) "IN"
["ttl"]=>
int(86400)
}
}
<br />
<b>Warning</b>: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]:
php_network_getaddresses: getaddrinfo failed: Temporary failure in name
resolution in
<b>/opt/wwwroot/qun_inner/modules/club/my_signatures.php</b> on line
<b>68</b><br />
<br />
<b>Warning</b>: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]: unable to connect to
xxx.xxx.com:80 (Unknown error) in
<b>/opt/wwwroot/qun_inner/modules/club/my_signatures.php</b> on line
<b>68</b><br />
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43687&edit=1