|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48051 mysql_connect slow
Submitted: 2009-04-22 15:39 UTC Modified: 2009-04-22 16:16 UTC
From: bouddhagod at hotmail dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.9 OS: Gentoo
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bouddhagod at hotmail dot com
New email:
PHP Version: OS:


 [2009-04-22 15:39 UTC] bouddhagod at hotmail dot com
I made a connection to a mysql server. The first time i load the page all look fine. It take about 3500 - 400 ms to do the jog. The second time I load the page ( it's a login screen ) the same mysql_connect take about 5-6 sec. Thoses 2 servers is located on the same computer ( dual xeon 2.4 with 1.5 gig of ram ). So I'm sure it's not a hardware problem.

Any suggestion ?

Reproduce code:
mysql_connect( "", "username", "password");

Expected result:
not 5 SEC to responde...

Actual result:
first loading : 300 ms
second loading : 5 SEC
third loading : 300ms
fourth loading : 5 SEC
Etc ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-22 15:47 UTC] bouddhagod at hotmail dot com
function microtime_float()
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
$time_start = microtime_float();

$tutu = mysql_connect("" , "user" , "password");


$time_end = microtime_float();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds\n";
 [2009-04-22 16:09 UTC] bouddhagod at hotmail dot com
If I put localhost all work fine.
 [2009-04-22 16:16 UTC]
This is probably firewall related or dns related. Nothing to do with PHP here.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 03:01:30 2024 UTC