cakephp uses old dns entry
Question
In our cakephp application, we do a
file_get_contents('http://my.web.com',... );
Recently we changed the ip address of my.web.com, and we modified our /etc/hosts file, and flush dns cache using /etc/init.d/nscd restart, and restarted apache.
However, file_get_contents still refer to the old ip address, while if we do ping, nslookup, curl on my.web.com, we get the new ip address.
What are we missing?
Thanks
Solution 2
It turned out the address is also used as Apache's VirtualHost name in our old server. Removing this entry solved the problem. Thanks anyway guys :)
OTHER TIPS
Just to be sure did you search your source code for occurrences of the old IP?
Have you cleared out the cache files in app/tmp/cache? I think CakePHP caches external requests and if your app has a debug level of 0 then this cache will stick around for a while. Try deleting the files (not folders) or set debug to above 0 temporarily to force cache reload.