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

 ID:                 63525
 Comment by:         yangqingrong at wudimei dot com
 Reported by:        admin at wudimei dot com
 Summary:            php5.4.8 connecting to mysql is slower then php5.2.6
 Status:             Open
 Type:               Feature/Change Request
 Package:            MySQL related
 Operating System:   windows 7
 PHP Version:        5.4.8
 Block user comment: N
 Private report:     N

 New Comment:

i edited the code like this:

<?php
$a = microtime( true );
$conn = mysql_connect("localhost","root","123456");
mysql_select_db("yqr");
$q = mysql_query("show tables");
while( $r = mysql_fetch_assoc( $q ))
{
    print_r( $r );
}
 echo "<br /><b>connect to mysql take ". (microtime(true ) - $a); echo " 
seconds</b>"; 
 phpinfo();
 
?>


to see the result,copy the url below and paste it to the address bar of browser:

http://www.wudimei.com/data/YangQingrong/php5.2.6.jpg
http://www.wudimei.com/data/YangQingrong/php5.4.8.jpg


Previous Comments:
------------------------------------------------------------------------
[2012-11-15 11:59:54] admin at wudimei dot com

i use ip,not localhost.
http://127.0.0.18/wudimei_show/admin_S2D3L56N8K5L/component_types.php?act=index

------------------------------------------------------------------------
[2012-11-15 09:37:35] and...@php.net

Can you try 127.0.0.1 instead of localhost and report the connect time?

------------------------------------------------------------------------
[2012-11-15 09:09:19] admin at wudimei dot com

Description:
------------
php5.4.8 connecting to mysql is slower then php5.2.8

i use php5.4.8 to connect the mysql,it's slow!it take about 1.0138568878174 
seconds.
then i switch to php5.2.6 ,it only take 0.00234985351562 seconds.

please improve it
thank you!

yang qingrong

Test script:
---------------
<?php
$a = microtime( true );
$conn = mysql_connect("localhost","root","123456");
mysql_select_db("yqr");
$q = mysql_query("show tables");
while( $r = mysql_fetch_assoc( $q ))
{
    print_r( $r );
}
 echo microtime(true ) - $a; echo " seconds"; exit();
?>

php5.4.8 output:

Array ( [Tables_in_yqr] => account_book ) Array ( [Tables_in_yqr] => customer ) 
Array ( [Tables_in_yqr] => domain ) Array ( [Tables_in_yqr] => friends ) Array 
( [Tables_in_yqr] => hourly_work ) Array ( [Tables_in_yqr] => 
hourly_work_project ) Array ( [Tables_in_yqr] => notepad ) Array ( 
[Tables_in_yqr] => notepad_ctg ) Array ( [Tables_in_yqr] => schedule ) 
1.0138568878174 seconds

php 5.2.6 output
Array ( [Tables_in_yqr] => account_book ) Array ( [Tables_in_yqr] => customer ) 
Array ( [Tables_in_yqr] => domain ) Array ( [Tables_in_yqr] => friends ) Array 
( [Tables_in_yqr] => hourly_work ) Array ( [Tables_in_yqr] => 
hourly_work_project ) Array ( [Tables_in_yqr] => notepad ) Array ( 
[Tables_in_yqr] => notepad_ctg ) Array ( [Tables_in_yqr] => schedule ) 
0.00234985351562 seconds



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



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

Reply via email to