PHP mysql_connect is slow 1 second for localhost windows 7

I recently moved my development from XP to Windows 7 and found that webpages I had developed were taking 5 seconds long to load. This was unacceptable of course so I had to track down the problem.
I eventually tracked down the offending function/method pdo::construct. I also found that mysql_connect was taking about 1 second to make a connection. After a little googling I found an explaination that php had issues with IPv6 and that you could fix the problem by either disabling IPv6 or switching to the ipaddress 127.0.0.1 when making your connection.

Here’s a link to the thread where I found the information.

It’s a simple problem but I figured I would share/help boost visibility of it.

This is a reposted restored from wayback machine.

Leave a Reply

Your email address will not be published. Required fields are marked *