Bug #51085 [Com]: Mysql Connect takews too long

From: Date: Sat, 16 Mar 2013 00:07:40 +0000
Subject: Bug #51085 [Com]: Mysql Connect takews too long
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-177828@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=51085&edit=1

 ID:                 51085
 Comment by:         info at daverandom dot com
 Reported by:        djokodonev at gmail dot com
 Summary:            Mysql Connect takews too long
 Status:             Not a bug
 Type:               Bug
 Package:            Performance problem
 Operating System:   windows 7
 PHP Version:        5.3.1
 Block user comment: N
 Private report:     N

 New Comment:

For a full and detailed explanation of this problem and the solution see 
http://stackoverflow.com/a/15436435/889949.

Long story short: this is a Windows problem and not a PHP bug, and this bug report 
should be closed.


Previous Comments:
------------------------------------------------------------------------
[2012-10-29 00:30:26] mikegrey28 at hotmail dot com

Solution in Win7 maybe the next one:

On Windows 7 localhost resolves to ::1, and MySQL doesn't support IPv6 as far as 
I know.

Connecting directly to 127.0.0.1 resolves this problem; but you can edit the 
hosts file to resolve localhost to 127.0.0.1, then localhost will work too:

Open C:\Windows\System32\drivers\etc\hosts
Remove the following line, if present: ::1 localhost
Add the following line, if not present: 127.0.0.1 localhost

--------
This solved my issue, now my connection takes 0.01 seconds instead of the 1 sec.

Cheers.

------------------------------------------------------------------------
[2012-10-29 00:23:13] mikegrey28 at hotmail dot com

I had WinXP 32 bits running EasyPHP.
My script connected to MySql in milliseconds.

Now I migrated to Win 7 64bit and the some code is now taking 1 second to connect 
to mySQL (with firewall ON or OFF, it's the same).

Maybe I should get an EasyPHP build for 64bit but I can't find it :S

Cheers.

------------------------------------------------------------------------
[2012-08-21 05:16:14] m dot mihailko at gmail dot com

I have the similar problem. Do you find a solution?

------------------------------------------------------------------------
[2010-02-18 23:59:47] djokodonev at gmail dot com

Yes,

Well there isn't any load on the Machine, neither queries slow or any.

Already tried disabling the Firewall it gave no result. 

Tried entering "localhost", 127.0.0.1, "localhost:3306", etc. They all gave the
same result. So it is not a DNS issue? as far as i can tell. 

But just in case i have the localhost added in the win/system32/drivers/etc/hosts file mapping to
127.0.0.1


I've tried opening MYSQL from the command line(cmd) and it seems instantaneous  connection
compared to the 0.5 sec that takes php (mysql_connect) to connect.

NOTE that the Delay is always 0.5 sec. (+- 0.02) sec.

I simple doesn't makes sense but a lot of things don't i guess =).

And the configuration I am running is exactly thee same one as before. I triple or checked at least
10 times. I've been playing with this for at least 4 days now. 

Now I don't think that i can find a book or go to seminar or anything that i offered on the php
support page. 

Anyways it is not bogus... Maybe it is MYSQL related not php related but you'll be getting such
requests a lot in the coming months with people going over to WIN 7.

I've tried all the Google Related pages to look up a solution to this problem and tried
installing a few versions of php and mysql to test out whether there is any difference if one would
work compared to other WITHOUT ANY RESULTS. 

And it would have been great if I could actually see where the delay is.. If it in the computer or
something needs to be tweaked.. et. but i have no idea on how to do that.

------------------------------------------------------------------------
[2010-02-18 17:42:09] aharvey@php.net

-Status: Open
+Status: Bogus

This looks broadly similar (albeit on a different OS) to bug #48051, which wasn't a PHP issue
as such either. Try disabling any firewalls you have enabled, check that MySQL isn't under
undue load, see if connections from other applications (such as the MySQL command line client) also
have a similar delay, et cetera.

At any rate, your problem does not imply a bug in PHP itself. For a list of more appropriate places
to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not
the appropriate forum for asking support questions.

Thank you for your interest in PHP.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=51085


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=51085&edit=1


Thread (1 message)

  • info at daverandom dot com
  • Unknown Message
    • info at daverandom dot com
« previous php.bugs (#177828) next »