[PHPLondon-discuss] PHP URL/DNS Cache?

Khalid Hanif khalid at hanif.me.uk
Fri Sep 28 11:46:29 BST 2007


Hi Guys,

I've had a problem today (now fixed), but would appreciate some  
advice. Here's the situation:

Server was using the opendns IP's as the DNS resolvers in /etc/ 
resolv.conf initially.
Using PHP, we did a URL fetch (curl + file_get_contents had the same  
results) and got an opendns page: http://guide.opendns.com/? 
url=asdasdd.ssssa - where http://asdasdd.ssssa was the URL. Obviously  
this should fail, but openDNS has wildcards setup, so it goes through  
to a page of similar results etc.

We obv. didn't want this, so /etc/resolv.conf was changed to use the  
DC DNS servers. At this point, on the shell, a

dig asdasdd.ssssa

resulted in nothing. Same for

lynx http://asdasdd.ssssa

Yet, PHP would still return the opendns results - even if the URL was  
changed. It was as if it had cached the resolv.conf IP's from before.  
Bind is running as a caching NS, and this was reloaded & restarted,  
to no avail. Apache was also restarted. nscd isn't used. We're  
running FC 6.

In the end, the only way we solved it was to reboot the entire  
server. Not ideal, but luckily it was a development server.

So... the million dollar qn is:

How would you 'flush' the cache without rebooting?

Appreciate your comments

Cheers,
Khalid



More information about the Phplondon-discuss mailing list