|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-08 16:20 UTC] uni at daniel-marschall dot de
Description:
------------
I am trying to find out if a webserver has A-records or not. I found out that for the server "us.ibm.com" the results vary from client to client. Since I am writing an OpenSource application, I wish that the results of checkdnsrr() are consistent. I am not sure if it is a bug in PHP.
Test script:
---------------
<?php
$phpver = phpversion();
echo "PHP version: $phpver<br>\r\n";
echo $_SERVER["SERVER_SIGNATURE"] . "<br>\r\n";
$server = 'us.ibm.com';
if (checkdnsrr($server, 'A')) {
echo "$server A-record: VALID";
} else {
echo "$server A-record: NOT VALID";
}
?>
Expected result:
----------------
I do not know which result is correct. I checked the A-record at many different webservices and each webservice has different results.
Example:
* MX Toolbox: http://mxtoolbox.com/SuperTool.aspx?action=a%3aus.ibm.com (NO A-RECORD)
* My-Addr.com: http://my-addr.com/domain-hostname-dns-records/isp-country-geo-ip-location/online-nslookup-tool/domain_info.php?domain=us.ibm.com&x=0&y=0 (A-RECORDS e32.co.us.ibm.com FOUND, but therefore no IP, so data MAY be incorrect)
* OpenDNS also outputs some A-records for that domain, but I am not sure if they are valid
* ntchosting.com: http://www.ntchosting.com/dns/host.html#Check_the_A_record - Various A-record FOUND! (e.g. e1.ny.us.ibm.com )
Actual result:
--------------
Some PHP clients output "A record found", others output "No A record found". I do not know if it is controlled by the OS, the network or the PHP version.
Examples for data I collected:
1. Tested at my Debian server (viathinksoft.de) and A-record FOUND. Software: Apache/2.2.9 (Debian) DAV/2 SVN/1.5.1 PHP/5.2.6-1+lenny8 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0
2. Tested at my XAMPP localhost with Windows XP Home and A-record FOUND. Software: Windows XP Home; XAMPP; Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
3. Tested at my university's server (jonathan.sv.hs-mannheim.de) and A-record NOT found. Software: Apache/2.2.8 (Fedora). PHP version: 5.2.6.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 07:00:02 2025 UTC |
I don't think it is a bug in PHP. Both on windows and linux PHP uses the system functions. They return the requested records and PHP only transforms them to be usable by a PHP script. I checked the us.ibm.com domains, the issue I can see is some recursive resolution, which creates confusions with some dns clients or relays (DNS intermediate server). But that's not something PHP can solve. Below is the answer for mines, as you can see, no A entry, checkdnsrr returns false as well, obviously. Closing this bug as not a php bug > bogus. Array ( [0] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e39.co.us.ibm.com [class] => IN [ttl] => 3583 ) [1] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e9.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [2] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e5.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [3] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e3.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [4] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e4.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [5] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e37.co.us.ibm.com [class] => IN [ttl] => 3583 ) [6] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e6.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [7] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e2.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [8] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e31.co.us.ibm.com [class] => IN [ttl] => 3583 ) [9] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e35.co.us.ibm.com [class] => IN [ttl] => 3583 ) [10] => Array ( [host] => us.ibm.com [type] => TXT [txt] => v=spf1 ip4:32.97.182.0/24 ip4:32.97.110.0/24 a:d25xlcore010.ca.ibm.com a:isource.boulder.ibm.com ~all [entries] => Array ( [0] => v=spf1 ip4:32.97.182.0/24 ip4:32.97.110.0/24 a:d25xlcore010.ca.ibm.com a:isource.boulder.ibm.com ~all ) [class] => IN [ttl] => 583 ) [11] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e38.co.us.ibm.com [class] => IN [ttl] => 3583 ) [12] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e8.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [13] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e32.co.us.ibm.com [class] => IN [ttl] => 3583 ) [14] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e33.co.us.ibm.com [class] => IN [ttl] => 3583 ) [15] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e1.ny.us.ibm.com [class] => IN [ttl] => 3583 ) [16] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e34.co.us.ibm.com [class] => IN [ttl] => 3583 ) [17] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e36.co.us.ibm.com [class] => IN [ttl] => 3583 ) [18] => Array ( [host] => us.ibm.com [type] => MX [pri] => 10 [target] => e7.ny.us.ibm.com [class] => IN [ttl] => 3583 ) )It sounds logical that PHP calls the OS's DNS resolution and it is likely that it is not a PHP bug. But I am just very confused about this. I checked following script <?php $result = dns_get_record("us.ibm.com"); print_r($result); ?> at the systems which output "A-records available". At these two systems, Windows and Debian Linux, I get the same list as you get: TXT entries and many MX entries. So, my big question is: Why is checkdnsrr('us.ibm.com', 'A')=true at some systems when dns_get_record() is without any [type]='A' entry?