Everything, Everything - November 2009

2021: January
2020: J F M A M J J A S O N D
2019: J F M A M J J A S O N D
2018: J F M A M J J A S O N D
2017: J F M A M J J A S O N D
2016: J F M A M J J A S O N D
2015: J F M A M J J A S O N D
2014: J F M A M J J A S O N D
2013: J F M A M J J A S O N D
2012: J F M A M J J A S O N D
2011: J F M A M J J A S O N D
2010: J F M A M J J A S O N D
2009: J F M A M J J A S O N D
2008: J F M A M J J A S O N D
2007: J F M A M J J A S O N D
2006: J F M A M J J A S O N D
2005: J F M A M J J A S O N D
2004: J F M A M J J A S O N D
Help 24x7
Friday 27th November, 2009 11:36
I noticed that NatWest's online baking site has this new help box on the left hand side, which allows you to ask questions. Their example question said "How do I move money?", but I thought it might be more interesting to ask this question:

How do I launder money?

Sadly I didn't have the balls to hit the "Ask" button.
Localhost !=
Friday 20th November, 2009 15:06
At least that's what PHP 5.3.1 seems to think. I tried upgrading a system that was running PHP from 5.3.0 to 5.3.1 and several parts of several websites broke. I narrowed it down to anything that was trying to do database access, which made me investigate the extensions and libraries (which were fine). So I decided to look more closely (locally, using php-cgi from the command prompt so I could see all the errors) and I discovered that the errors were caused by PHP's inability to access the MySQL server. The MySQL server was running fine, which I already knew because PHP 5.3.0 was happy, as were other services that depend on MySQL working correctly. Here's the error message that was returned:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

How to replicate this? Simple, try the following:


$dbhost = ("localhost");
$dbname = ("dbname");
$dbuser = ("dbuser");
$dbpass = ("dbpass");

@$dbh=mysql_connect ("$dbhost", "$dbuser", "$dbpass") or die (mysql_error());


But if you change "localhost" to "" you get:

Access denied for user 'dbuser'@'localhost' (using password: YES)

If I'd used valid credentials, I wouldn't get the access denied error, but I'm not going to tell you any usernames and passwords!

So does anyone know why PHP 5.3.1 isn't able to resolve localhost as Or is this perhaps some kind of IPv6 quirk, as MySQL is only listening on an IPv4 address, but PHP 5.3.1 might be trying an IPv6 address? I can't see many references to DNS changes in the PHP changelog, except perhaps this:

Improved dns_get_record() AAAA support on windows. Always available when IPv6 is support is installed, format is now the same than on unix.

Perhaps that's the cause?
© Robert Nicholls 2002-2021
The views and opinions expressed on this site do not represent the views of my employer.