A connection attempt failed because the connected party did not properly respond

If you’re like me, using EasyPHP on Windows 7 for local development and have encountered this PHP/MySQL error:

Warning: mysql_connect() [function.mysql-connect]: [2002]
A connection attempt failed because the connected party did
not (trying to connect via tcp://localhost:3306) in
C:\Path\To\Script.php on line 26

Warning: mysql_connect() [function.mysql-connect]: 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. in
C:\Path\To\Script.php on line 26

Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Path\To\Script.php on line 26

..then you’re in luck! Here’s a quick easy fix:

  1. Go to “C:\Windows\System32\drivers\etc“.
  2. Open “hosts” with Notepad program.
  3. Uncomment this line: “127.0.0.1 localhost” or add it if it’s not on the host entry.

That’s it! Save the changes you’ve made and refresh your browser.

Hope this helps!

* NOTE – Make sure you have a full access on “hosts” file.

  1. Right click on “hosts” file then click “Properties“.
  2. On “Security” tab click “Edit…” button.
  3. Select the user that you are currently using.
  4. Under “Permissions for Users” box, tick “Full control” on “Allow” column.
  5. And then click “OK” button to apply the changes.

EasyPHP on 64 bit Windows 7: How to fix Apache and MySQL problem

EasyPHP on Windows 7

EasyPHP on Windows 7


Apache

I am accustomed in using EasyPHP on a Windows platform. Installation, running, and configuring it is always a breeze (on Windows XP that is). Recently I’ve installed Windows 7 RTM on my MSI notebook and installed EasyPHP 5.3.0, though the Installation goes flawlessly but then when I launch the stack software, Apache wouldn’t start.

I turned off the firewall but no luck. So I did a search on google, again no luck with Windows 7 specific solution but I found one for Windows Vista. I tried it anyway, then BAM! It worked! I finally got Apache to start, tried opening the local default web and it worked perfectly. Here’s the error message and how to fix it:

Apache cannot be runned: another Web server use the Web port
or port is blocked by firewall.
  1. Click the EasyPHP icon beside “Apache” button.
  2. Click “Configure” then click “EasyPHP“.
  3. Uncheck “Check server’s TCP port before starting” then click “Apply” button and then “Close” button.
  4. Click “Apache” button and then click “Start“.

That would fix the “Apache cannot be runned…” problem.

MySQL

Got the Apache server to work but after I closed EasyPHP and run it again, I’m hit with another error message:

Unexpected end of MySql... See log file?

Now it’s from MySQL. After a few head scratching and inspection. And then it hit me! I figure that must be a permission problem. So I changed my user’s permission for the EasyPHP directory and Viola! MySQL finally start. Solved the MySQL problem. Here’s what I did:

  1. Go to “Computer“, open/view Drive C, then double click “Program Files (x86)“.
  2. Right click on “EasyPHP5.3.0” folder then click “Properties“.
  3. On “Security” tab click “Edit…” button.
  4. Select the user that you are currently using.
  5. Under “Permissions for Users” box, tick “Full control” on “Allow” column.
  6. And then click “OK” button to apply the changes.

Now you’ll be able to start MySQL server by clicking “MySQL” button on EasyPHP dialog and then click “Start“.

Hope this helps!