Re: gethostbyname () uses old DNS server

From: Date: Mon, 26 Mar 2007 09:40:39 +0000
Subject: Re: gethostbyname () uses old DNS server
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-251356@lists.php.net to get a copy of this message
Kent Tong wrote:
We have moved our DNS server from one IP to another. But on a Linux server, the PHP programs keep using the old DNS server IP. For example, for a simple php file: <? echo gethostbyname ("smtp.cpttm"); ?> When it is run, it tries to lookup smtp.cpttm using the old DNS server (I know it using tcpdump). The new DNS server is specified in /etc/resolv.conf. If I issue "ping smtp.cpttm" in a command prompt, then tcpdump shows that it is accessing the new DNS server.
Assuming you're using a web server it's possible PHP is caching the DNS server details. Try restarting the web server. Alternatively try the same script on the command line. -Stut

« previous php.general (#251356) next »