Re: gethostbyname

From: Date: Tue, 02 Mar 1999 23:46:48 +0000
Subject: Re: gethostbyname
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-4445@lists.php.net to get a copy of this message
On Tue, Mar 02, 1999 at 05:05:35PM -0600, Timothy Whitfield wrote: > Tried gethostbyname on same slackware box and sure enough, did not work unless > name was in the hosts file. I am in persuit tho. =) (a) the libc of the box is buggy (b) the IP of the nameserver is not set correctly (c) domain/search settings in resolv.conf are wrong Run strace on the following one-liner: main(int argc, char **argv) { printf("looking up %s - result: %s\n", argv[1], gethostbyname(argv[1]) ? "ok" : "bad"); } Take your special hostname out of /etc/hosts and see, if you can look it up with the one-liner. If it does not work, you have 100% one of the problems listed above. You could run strace (better: ltrace) on the one-liner to see what the resolver tries to do - maybe you can catch some error message which helps in hunting down the problem. > btw- don't you think gethostbyname should return false if it can't find the > name instead of returning the name it tried??? I agree, especially since _php3_gethostbynamel would return an empty array in this case. -- Regards, Sascha Schumann | Consultant | finger sas@schell.de | for PGP public key -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4445) next »