For Programmers: Free Programming Magazines  


Home > Archive > PHP on Windows > May 2004 > RE: [PHP-WIN] Windows speed issue









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PHP-WIN] Windows speed issue
Trevor Gryffyn

2004-05-13, 3:30 pm

Is the web server (IIS) giving you a timeout or is PHP? If it's PHP,
you can change your max execution time with "set_time_limit" or I
believe you can change it in your PHP.INI

If it's IIS, then I'm very familiar with the error. Hah. I work doing
data analysis and sometimes we deal with very large sets of data. I
think our IIS servers timeout after 10 minutes or so (CGI Timeout..blah
blah.. Script terminated).

Indexing should definitely help on the database side.

I don't see anything major with your script below (quick glance) except
for the fact that you don't have a beginning or ending <TABLE> tag. But
if all the data is sent, then IE is usually smart enough to make up for
a coding faux pas like that.

It's very odd that it runs fast on the server but times out on other
systems unless the other systems are significantly lesser machines than
the server. If it's a large table being sent, it can take a while to
render the table on the client side.


I guess what I'd do at this point is to try breaking it up a little.
Toss a WHERE clause in there and limit your recordset. Put some breaks
in the middle of the code to see if there's a certain segment of it
that's causing issues (You could try installing Zend Studio client and
server component and seeing if it's Profiler can show you were the
bottleneck is.. It's pretty slick. http://www.zend.com free trial on
the client and server).

Good luck though.. It's going to end up being something silly that
you're going to kick yourself for.. Hah..

-TG

> -----Original Message-----
> From: Andrew Staples [mailto:andrews@ltinet.net]=20
> Sent: Thursday, May 13, 2004 2:26 PM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Windows speed issue
>=20
>=20
> I'm fairly new to php, hoping someone can help. I have a webpage that
> displays records from a table. The problem is that viewing=20
> the page on via
> any browser other than a browser directly on the server gives=20
> me a timeout
> error. When run on the server, it's extremely fast. What am=20
> I doing wrong?
> (I tried indexing the city fields). This is on a win2003 server.
>=20
> The code is below. =20
>=20
> <?
> // open database connection
> db_connect();
> // generate and execute query
> $query =3D "SELECT * FROM milage ORDER BY city";
> $result =3D mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());
> // if records present
> if (mysql_num_rows($result) > 0)
> {
> // iterate through resultset
> // print title with links to edit and delete scripts
> while($row =3D mysql_fetch_object($result))
> {
> ?>
> <tr><td>
> <font size=3D"2"><b><? echo $row->city; ?></b></font></td>
> <td>
> <font size=3D"2"><b><? echo $row->miles; ?></b></font></td>
> <td><font size=3D"2"><a href=3D"edit.php?id=3D<? echo $row->cityid;
> ?>">Edit</a></td>
> <td><a href=3D"delete.php?id=3D<? echo $row->cityid;
> ?>">Delete</a></font></td>
> </tr>
> <?
> }
> }
> // if no records present
> // display message
> else
> {
> ?>
> <font size=3D"-1">No Locations Listed</font><p>
> <?
> }
> // close connection
> ?>
>=20
> --=20
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>=20

Steven Sher

2004-05-14, 4:30 am

Not sure if this will help, but I have seen a significant improvement in
speed, by switching from using normal mysql_connect() to mysql_pconnect()

Using a persistent connection helped me, you may need to adjust some setting
for it to work affectively



-----Original Message-----
From: Andrew Staples [mailto:andrews@ltinet.net]
Sent: Thursday, May 13, 2004 8:26 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Windows speed issue


I'm fairly new to php, hoping someone can help. I have a webpage that
displays records from a table. The problem is that viewing the page on via
any browser other than a browser directly on the server gives me a timeout
error. When run on the server, it's extremely fast. What am I doing wrong?
(I tried indexing the city fields). This is on a win2003 server.

The code is below.

<?
// open database connection
db_connect();
// generate and execute query
$query = "SELECT * FROM milage ORDER BY city";
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print title with links to edit and delete scripts
while($row = mysql_fetch_object($result))
{
?>
<tr><td>
<font size="2"><b><? echo $row->city; ?></b></font></td>
<td>
<font size="2"><b><? echo $row->miles; ?></b></font></td>
<td><font size="2"><a href="edit.php?id=<? echo $row->cityid;
?>">Edit</a></td>
<td><a href="delete.php?id=<? echo $row->cityid;
?>">Delete</a></font></td>
</tr>
<?
}
}
// if no records present
// display message
else
{
?>
<font size="-1">No Locations Listed</font><p>
<?
}
// close connection
?>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

~~~~ Scanned by neroAntiVirus.com (19:28:11 SPITFIRE) ~~~~


--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
Andrew Staples

2004-05-14, 5:30 pm



-----Original Message-----
From: Gryffyn, Trevor [mailto:TGryffyn@air-cargo-inc.com]

going to kick yourself for.. Hah..


Yes, kicks are in order. I changed from using php4isapi.dll to php.exe, and
instant success. Here I thought the dll would be faster...(using php
4.3.6). I'd be interested in others feedback.

Andrew

[color=darkred]
> -----Original Message-----
> From: Andrew Staples [mailto:andrews@ltinet.net]
> Sent: Thursday, May 13, 2004 2:26 PM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Windows speed issue
>
>
> I'm fairly new to php, hoping someone can help. I have a webpage that
> displays records from a table. The problem is that viewing the page
> on via any browser other than a browser directly on the server gives
> me a timeout error. When run on the server, it's extremely fast.
> What am I doing wrong?
> (I tried indexing the city fields). This is on a win2003 server.
>
> The code is below.
>
> <?
> // open database connection
> db_connect();
> // generate and execute query
> $query = "SELECT * FROM milage ORDER BY city"; $result =
> mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());
> // if records present
> if (mysql_num_rows($result) > 0)
> {
> // iterate through resultset
> // print title with links to edit and delete scripts
> while($row = mysql_fetch_object($result))
> {
> ?>
> <tr><td>
> <font size="2"><b><? echo $row->city; ?></b></font></td>
> <td>
> <font size="2"><b><? echo $row->miles; ?></b></font></td>
> <td><font size="2"><a href="edit.php?id=<? echo $row->cityid;
> ?>">Edit</a></td>
> <td><a href="delete.php?id=<? echo $row->cityid;
> ?>">Delete</a></font></td>
> </tr>
> <?
> }
> }
> // if no records present
> // display message
> else
> {
> ?>
> <font size="-1">No Locations Listed</font><p> <?
> }
> // close connection
> ?>
>
> --

Mike Booth

2004-05-20, 7:30 am

I believe this is the same problem I found a fix for in thread "php
performance on IIS 6" (23749)

If you're running in isapi mode turn on output-buffering, I haven't looked
into this fully, and its weird that it works fast from the local machine
(had the same issue)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com