MySQL Forums
Forum List  »  PHP

MySQL/PHP on Vista very slow...why?
Posted by: Saul Krimsly
Date: December 03, 2007 10:23AM

I just installed MySQL 5.0.45 and PHP 5 on a fast Vista Home Premium notebook with 2G memory--I use this computer for client demonstrations--and noticed that MySQL queries run especially slow, even for relatively small database tables.

From my Windows 2000 and XP servers, queries POSTed to IIS6/PHP/MySQL take microseconds to process and perhaps a tenth of a second to display the results in a browser table. However, the same database query on the Vista setup (with IIS7, using php_mysql) takes between .6 and .9 seconds to process and display. Any ideas why or how to correct this?

BTW, the install was difficult and most of the online guides were incomplete...I even had to manually edit the Envormental Path to include C:\php and C:\php\ext before PHP would recognize the php_mysql.dll.

My typical php script looks like this...

<?php
//filename: query_result_rows.php
$sqlhost=$_POST['sqlhost'];
$sqldb=$_POST['sqldb'];
$sqluser=$_POST['sqluser'];
$sqlpasswd=$_POST['sqlpasswd'];
$sqlquery=$_POST['sqlquery'];
$connID=@mysql_connect($sqlhost,$sqluser,$sqlpasswd);
$result=@mysql_db_query($sqldb,$sqlquery,$connID);
$NumReturnedRows=@mysql_num_rows($result);
$showerr='';
if (mysql_errno ())
{
$showerr=mysql_error();
die("! $showerr");
}
// display the count or zero
echo "$NumReturnedRows\r";
// return the result, if any
if ($NumReturnedRows>0)
{
while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
{
foreach ($line as $col_value)
{
echo "$col_value|";
}
echo "\r";
}
}
mysql_free_result($result);
mysql_close($connID);
?>

Thanks, Saul Krimsly.

Options: ReplyQuote


Subject
Written By
Posted
MySQL/PHP on Vista very slow...why?
December 03, 2007 10:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.