Answer the question
In order to leave comments, you need to log in
What does gethostbyname resolve bypassing resolv.conf?
Gethostbyname and nslookup return different values. Nslookup is correct, gethostbyname is left (from the cache?) - I set both my 127.0.0.1 and Google's 8.8.8.8 in resolv.conf.
Where does gethostbyname get its value from?
Since you need to take A through php, I would like to figure it out.
If you call nslookup through PHP, the value is correct, but it is slower and more crooked than native PHP.
Through PHP dns_get_record is also left.
Answer the question
In order to leave comments, you need to log in
nslookup makes a request directly to the DNS server, and gethostbyname first breaks through /etc/hosts, according to the setting in /etc/nsswitch.conf
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question