Click to See Complete Forum and Search --> : why fsockopen() use root dns info?? - about php


chtla
04-14-2004, 12:43 AM
I have poor english.. sorry..

my office is using private ip(192.168.x.x) and setting dns server.
i hope use web mail at office, i am programming..
----------------------------------------------------
$fp = fsockopen("off.com", 110, $errno, $errstr, 30);
if(!$fp){
echo "$errstr ($errno)";
else{
echo "result : ".$fp;
}

result : connection refused (61)
-----------------------------------------------------
i checked system.
and found problem..
problem is that fsockopen() used root dns info.(connect real domain, off.com)
not used office dns info.

office dns server------------
off.com - 192.168.123.107
---------------------------------
----------------------------------------------------------------------
dns server checking..(freebsd)

# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK <759a094ace3177203a8c63d9aca14700@bsd.off.com>

# telnet off.com 110
Trying 192.168.123.107...
Connected to off.com.
Escape character is '^]'.
+OK <042ee5976a121afae2c0f93f9da2c869@bsd.off.com>

client computer checking..(win xp)

C:\>ping off.com
Pinging off.com [192.168.123.107] with 32 bytes of data:

Reply from 192.168.123.107: bytes=32 time<10ms TTL=64
Reply from 192.168.123.107: bytes=32 time<10ms TTL=64
Reply from 192.168.123.107: bytes=32 time<10ms TTL=64
Reply from 192.168.123.107: bytes=32 time<10ms TTL=64

Ping statistics for 192.168.123.107:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\>telnet off.com 110
+OK <3caf8d16b7dd05cbcb8bd120a7dde09b@bsd.off.com>
-------------------------------------------------------------------------

i think no problem at office dns server setting
fsockopen why use root dns server information ??

Any help will be appreciated.
Thanks

p.s) office ip is dynamic ip and can't setting domain..

mdwatts
04-14-2004, 10:31 AM
Originally posted by chtla

result : connection refused (61)
-----------------------------------------------------
i checked system.
and found problem..
problem is that fsockopen() used root dns info.(connect real domain, off.com)
not used office dns info.

office dns server------------
off.com - 192.168.123.107


I'm not sure that I understand, but will at least attempt to help.

So the PHP script is picking up the wrong dns server? Do you have the correct dns server defined in /etc/resolv.conf?

domain <domain>.com
nameserver xxx.xxx.xxx.xxx # dns server 1
nameserver xxx.xxx.xxx.xxx # dns server 2

Also moved to the Web/Security forum.


Apache, security, MySQL, PHP, etc.