#40351 [Opn->Fbk]: DNS resolution fails with PHP
| From: | tony2001@php.net | Date: | Mon, 05 Feb 2007 10:19:51 +0000 |
| Subject: | #40351 [Opn->Fbk]: DNS resolution fails with PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108414@lists.php.net to get a copy of this message | ||
ID: 40351
Updated by: tony2001@php.net
Reported By: dae at datasec dot no
-Status: Open
+Status: Feedback
Bug Type: *Network Functions
Operating System: Trustix 3.0.5 RC1
PHP Version: 4.4.4
New Comment:
Does PHP CLI work for you?
Previous Comments:
------------------------------------------------------------------------
[2007-02-05 10:05:39] dae at datasec dot no
Sorry for not providing enough details the first time,
I wanted to be brief, but I was too brief then.
I have re-read the instructions, and if I
still don't provide enough details,
please specify what more details you need from me.
Thank you.
PHP can not do DNS-resolution,
all other software or parts of the OS can.
Postfix log-sample:
Feb 4 13:18:42 localhost postfix/smtp[8064]: 0EED46BC0D9:
to=<xxx@example.com>, relay=mx01.example.com[0.0.0.0], delay=0,
status=sent (250 2.0.0 l14CIjgK005386 Message accepted for delivery)
Bash example:
~# telnet php.net 80
Trying 69.147.83.197...
Connected to php.net.
~# nslookup php.net
Server: 213.x.x.x
Address: 213.x.x.x#53
Non-authoritative answer:
Name: php.net
Address: 69.147.83.197
~# nslookup 69.147.83.197
Server: 213.x.x.x
Address: 213.x.x.x#53
Non-authoritative answer:
197.83.147.69.in-addr.arpa name = y2.php.net.
Error log example:
[date] [error] PHP Warning: socket_connect() Host lookup failed
[-10002]: Host name lookup failure
PHP compile option:
'./configure' '--enable-memory-limit' '--enable-safe-mode'
'--enable-magic-quotes' '--enable-sockets'
'--prefix=/usr/local/php_4.4.4' '--with-openssl'
'--enable-force-cgi-redirect' '--with-apache=/root/inst/apache_1.3.37'
'--with-zlib'
------------------------------------------------------------------------
[2007-02-05 09:26:29] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2007-02-04 13:34:33] dae at datasec dot no
Description:
------------
PHP can not do DNS-resolution,
all other software or parts of the OS can.
Reproduce code:
---------------
$foo = gethostbyaddr('69.147.83.197');
echo 'gethostbyaddr [should show a hostname] : '.$foo."\n";
$foo = gethostbyname("php.net");
echo 'gethostbyname [should show an ip] : '.$foo."\n";
$host = explode('@', 'webmaster@php.net');
if(!checkdnsrr($host[1].'.', 'MX') ) {
echo "No MX record found for webmaster@php.net\n";
}
Expected result:
----------------
gethostbyaddr [should show a hostname] : y2.php.net
gethostbyname [should show an ip] : 69.147.83.197
Actual result:
--------------
gethostbyaddr [should show a hostname] : 69.147.83.197
gethostbyname [should show an ip] : php.net
No MX record found for webmaster@php.net
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40351&edit=1