PHP 5.3 and MySQL: A connection attempt failed because the connected party did not properly respond after a period of time…

Having difficulty connecting to MySQL through PHP 5.3.x? Know that MySQL and PHP are properly configured? Using Windows Vista / 7? The problem may very well be that you’re connecting to ‘localhost.’ According to Joe Bedan, simply changing ‘localhost’ to ‘127.0.0.7’ will fix the problem, and he’s right!

According to another forum post, this is because Vista/7 does some goofy stuff with the ‘localhost’ alias. This person suggests that modifying the C:\Windows\System32\drivers\etc\hosts file to contain the line ‘127.0.0.1 localhost’ will fix the problem (make sure to do this as an administrator!). Unfortunately, this wasn’t the case for me. However, it’s worth a shot for anyone experiencing this problem.


–Adam

Simple File Sharing Using BitTorrent

The other day, I asked a friend for some pictures of a concert and wedding that we both attended.  Normally, for smaller files, he’d just send me what I wanted through Skype.  However, as anyone who uses Skype will tell you, peer-to-peer transfer speed in the program is abysmal.  Not wanting to set him up a FTP account to my website, I suggested that we make the transfer using BitTorrent.  Assuming that you are using uTorrent and have the appropriate exceptions already declared in your firewall, here are the steps that you can take to share files between you and your friends:

  1. Figure out your Internet IP address.  If you don’t know what yours currently is, try http://whatismyip.com/.
  2. Figure out what port uTorrent is using.  Your current port can be found in the Options –> Speed Guide menu.
  3. In uTorrent, go to File –> Create New Torrent
  4. Select the file or folder that you would like to share
  5. In the trackers section, add the following:
    http://your_ip_address:port/announce
    http://localhost:port/announce
  6. Under “Other” select “Start Seeding”
  7. Click the “Create and save as…” button.
  8. Save the torrent file to your disk
  9. Send the torrent file to your friend
  10. Have your friend open the torrent
  11. Enjoy!

Some of you may be asking why we added the local machine (localhost) as a tracker in step #5.  Some routers act goofy and don’t forward data properly when you attempt to access the router’s Internet address from the local network.  Because of this, your friend will be able to connect to your machine, but you won’t!  In other words, “localhost” is for you and your Internet IP address is for your friends. 

As an aside, we found that sharing a folder transferred significantly faster than the same folder compressed into a zip file.  Sharing a zip file, we achieved a download rate of approximately 10 kbps.  With the folder, my friend and I were able to achieve a sustained download rate of approximately 60 kbps.  Not too shabby!

–Adam