#40351 [Csd->Bgs]: [BOGUS] DNS resolution fails with PHP
| From: | tony2001@php.net | Date: | Mon, 05 Feb 2007 12:34:09 +0000 |
| Subject: | #40351 [Csd->Bgs]: [BOGUS] DNS resolution fails with PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108419@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: Closed
+Status: Bogus
Bug Type: *Network Functions
Operating System: Trustix 3.0.5 RC1
PHP Version: 4.4.4
Previous Comments:
------------------------------------------------------------------------
[2007-02-05 12:32:22] dae at datasec dot no
Problem solved. This was a bogus bug report,
and I am definately very sorry.
Thank you very much for pointing me to PHP CLI Tony,
it helped me see the problem. I am very grateful for
quick and helpful feedback.
Only root can run PHP-CLI on my server, so
I finally figured out why php with apache couldn't
do DNS-lookups.
If anybody else experience this problem;
make sure /etc/resolv.conf are chmod 444 (or 644).
And also apache-daemon must be stopped and started
after making changes to resolv.conf.
I feel so stupid, very sorry again.
Keep up your great work with developing PHP,
it is my favorite!
------------------------------------------------------------------------
[2007-02-05 10:19:50] tony2001@php.net
Does PHP CLI work for you?
------------------------------------------------------------------------
[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