I faced an interesting (and by interesting, I mean incredibly frustrating) issue with a client yesterday, who had installed a PHP-based application of mine on their new Windows 7 laptop only to find that it was unable to connect to the MySQL database that powered it.

Testing showed that the connection was indeed failing, with this error being generated:

php_network_getaddresses: getaddrinfo failed: A non-recoverable error occurred during a database lookup.

I tried various things – forcing Windows to resolve localhost to 127.0.0.1 (rather than ::1) in the hosts file, disabling IPv6 altogether and disabling the anti-virus package (AVG). I even tried installing fresh, bang-up-to-date copies of Apache, PHP and MySQL. Nothing worked – although the hosts file edit did at least change the error message, now it just said “Unknown error” instead – still very helpful.

Bashing my head against a brick wall, I decided to turn off services one by one until the problem changed. So I did, and eventually I got to the services running as part of the AVG CloudCare anti-virus package.

Switching the Cloud Care service off suddenly meant that any pages I tried to load in my web browser were replaced with a silly “Your Cloud Care service is not running!” error message.

I uninstalled AVG Anti-Virus completely (rather than just disabling it) and the problem immediately disappeared.

One to remember!