Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





PHP Running Way To Slow T_T


About an hour ago my pages were taking around 0.01 seconds to load. Now those same pages are taking like 5.00 seconds to load. CPU usage is 1%

Why are they going so slow all of a sudden? Even pages that I have not edited at all whatsoever in any way are suddenly slow as poop when they used to be loading instantly an hour ago! Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Mysql Running Slow
I'm a php guy and db system issues are not my thing. My server (linux) is running mysql 4.0.15, and running SLOW, very slow. I did a search for the slow query log file that the docs mention but could not find it. I have started changing the file types to myisam from innoDB. I'm wondering if the system is screwed up becuase the size of ibdata1 (where innodb data is stored) is 1344274432 bytes (about 1.1 GB), but as I convert tables from innodb to myisam (lots of them with lots of data), the file size of ibdata1 is not going down.

View Replies !
Suddenly Started Running Slow!
So the other day, I was fiddling with the php.ini file on my web server trying to figure out why my 30mb file wasn't uploading, so I started changin some settings and then tried to upload my file again...

Out of nowhere, the php script started taking forever to execute!

you can see it here: ....

View Replies !
Site Running Slow Transferring To HTTPS
I have an intermittent issue with my site in that, at times, it runs really, really slow when it transfers from http to https. The server administrators says there's no problem their end so I'm kinda stumped, as it runs fine most of the time, then for a couple of hours on some evening or weekend, any request has about a 10% chance of getting onto the next (secure) page. The page takes forever and might eventually load after a few minutes. I'm not running any cron jobs at the time, I think I've ruled out network attacks. This happens with the public https pages. The password protected, back-end https pages seems slow, but still get there. So really what I'm asking is this: Are there any inherent pitfalls to look out for at that point of transferring from http to https?

View Replies !
PHP Running Exec() Windows Program Very Slow In Comparison To UNIX Equivalent Program
Does anyone have an explanation or solution for the following.
I have a PHP script that uses exec() to call a program to do certain
calculations.

The UNIX version of this program I call runs in about 4 to 5 seconds.
When I run the same PHP script using exec() to call the Windows equivalent
of this same program on my Windows desktop, it takes about 32 seconds....

View Replies !
Warning: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach()

in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39

Here is the script:

<?php
//get the variables from the other page
$id=$_POST['id_no'];
$sku=$_POST['sku'];
$description=$_POST['description'];
$order=($_POST['order_qty']);
$store=$_POST['store'];
$comment=$_POST['comment'];

$ip=$REMOTE_ADDR;

//check if store is empty
if(empty($store)) {
die("Store is required. Please press the back button and enter in your store.");
}

//connect to the database
require('../inc/database_conn.php');

//$month=getdate(mon);
//$day=getdate(mday);
//$year=getdate(year);
//$today=$year . "-" . $month . "-" . $day
$today=date('Y-m-d');

// create the unique order number

$headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')";

mysql_query($headerqry, $conn) or die(mysql_error());
$order_no=mysql_insert_id();
foreach($order_qty as $id_no => $val) {
if($order_qty[$id_no] > 0) {
$detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')";
mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry);
}
}

View Replies !
Slow Down
I have written this script, which connects to a mysql data base.. and receives results from it..but for some reason, it has become very slow when loading... any ideas on how to pin point why such things happen?

View Replies !
Slow PHP On IIS 6
I have PHP 4.3.1 running under IIS 6, when i access my website PHP is
verly slow
but when i access my website on my server using
http://localhost/mysite/ php is very fast.

View Replies !
PHP 5 - XSL Slow?
I've just installed PHP 5 under Fedora Core 2 and I've been having
speed problems with xsl and the dom functions. Previously I used
the sablotron extension functions under PHP 4 with script execution
times of under 5 seconds ( max of 0,2M xml files, with a fair
number of xsl:key statements). Under PHP 5 execution times almost
seem random and never seem to use the full system resources
(memory-limit wasn't included as a compile option) -- script
execution times are often ten times longer that under PHP 4. Has
anybody else encountered problems with these functions and/or is
there a way to tell PHP to stop pussy-footing around and use the
system resources available to it (this isn't a shared environment)?

View Replies !
Cli Seems Very Slow
Anyone else have this issue? Even if I write a simple hello world! script with a shebang and run it, there seems to be a half a second or so delay before I get my response. Code:

View Replies !
Slow Code. Could I Do This Better?
I have a page that serves as a calendar for an object.
On this page theres a section that automaticaly generats every day in the selected year, in a month by month fassion.

What I'm trying to acomplish is to set bgcolor to green if the object is vacant, and red if not.

I get this to work, but it's paintaking slow the way I do it.
wich is: PHP Code:

View Replies !
Help..PHP/APACHE Slow
Have compiled PHP 4 with MySQL support into my Apache 1.23.32 server. It works great but I've noticed it drastically slows down the speed at which the pages load. I would expect a php script with a DB query to be slower, but this goes for almost 10 seconds or more on the same network. HTML zaps onto the screen real quick.Is there a way I can make the server respond faster?

View Replies !
Slow Loading
I recently moved to a new server. I've noticed that index.php (first page anyone sees) is extremely slow to load. On the old server it loaded fast. The servers have the same specs. What could the issue be?

View Replies !
File() Too Slow
I am trying to process a CSV file but am having trouble with my hosts
maximum execution time of 30 seconds.

This is how the script works at the moment.
User uploads their CSV file
The script goes through the file() and writes smaller chunk files.
The script then goes through processing the smaller files, populating the
database, deleting the processed file and refreshing itself, thus starting
again.

This system works for files up to 15000 rows, but I need to be able to
process larger files.

The bottleneck is with the initial splitting, since I use the file()
function to read the entire uploaded file.

Does anyone know a quicker way to split a file into smaller chunks.

View Replies !
PHP And Ajax - Very Very Slow
PHP and Ajax - very very slow

How do you people use PHP with Ajax?

I have been using this code, but there must be something wrong because
it takes too long to get the answer from the server. I really need,
somehow, to check if the IE version is 5.

The main point is: where there more than 500 people connected to the DB
it becomes really slow.

Ajax code:
var agt = navigator.userAgent.toLowerCase();
var isIe = (agt.indexOf('msie') != -1);
var isIe5 = (agt.indexOf('msie 5') != -1);
var uniqueCounter = (new Date).getTime();

function createXmlHttpReq(handler) {
if (isIe) {
var control = (isIe5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
try {
xmlhttp = new ActiveXObject(control);
xmlhttp.onreadystatechange = handler;
} catch (e) {}
} else {
xmlhttp = new XMLHttpRequest();
xmlhttp.onload = handler;
xmlhttp.onerror = handler;
}
return xmlhttp;
}

function xmlHttpGET(xmlhttp, url) {
xmlhttp.open('GET', url, true);
xmlhttp.send(null);
}

function xmlHttpPOST(xmlhttp, url, arg) {
xmlhttp.open('POST', url, true);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-Length", arg.length);
xmlhttp.setRequestHeader('Connection','close');
xmlhttp.send(arg);
}

function sendRequestGET(url) {
xmlhttp = createXmlHttpReq(function() {});
xmlHttpGET(xmlhttp, url);
}

function sendRequestPOST(url, arg) {
xmlhttp = createXmlHttpReq(function() {});
xmlHttpPOST(xmlhttp, url, arg);
}
========================================================================
My JavaScript in .php file (example):
...
function GetPerfilIndividual(id){
var arg = 'SOMETHING=1&SOME_ID=4343";
var xmlhttp = createXmlHttpReq(function() {
if(xmlhttp.readyState == 4) {
if(xmlhttp.status == 200) {
document.getElementById("DIV_DEST").innerHTML =
xmlhttp.responseText;
} else {
document.getElementById("DIV_DEST").innerHTML = "<font
color='red'>"+xmlhttp.status+" - "+xmlhttp.statusText+"</font>";
}
}
});
xmlHttpPOST(xmlhttp, 'my_php_file.php', arg);
}
...

my_php_file.php
- Access the database
- make about 8 SELECTs
- create some TABLEs
- closes database
- return

View Replies !
Php::xml_parse Really Really Slow
I have a website that is generated on the fly from XML templates. I've
been having some performance issues (pages taking 6 seconds or more to
be generated) and profiled the php code. (This is an embedded system
with a slow CPU.)

It turns out that php::xml_parse is very, very slow. My XML stuff isn't
that complex, but only 4 calls to xml_parse account for 1/2 of the time
it takes to generate the page.

Anyone know of a way to improve XML performance? I don't need ereg/preg
support, or anyting like that, but I have to get the xml_parser to run
faster....
This is my configure script:

../configure
--host=arm-linux
--target=arm-linux
--build=i686-pc-linux-gnu
--with-zlib-dir=$ROOTDIR/$PLATFORM/lib
--with-ming=$ROOTDIR/../src/ming-0.3.0
--disable-all
--enable-session
--enable-xml
--enable-sockets
--enable-fastcgi
--enable-ming
--enable-xdebug
--enable-force-cgi-redirect
--with-config-file-path=/etc
--prefix=/
--exec-prefix=/bin

View Replies !
Why Is This Script So Slow?
This script runs fine, but I'd like to know why it's so slow.. Thanks
for any help out there on how i can make it faster (it might take up
to 5 min to write these 3 export files whith 15 records each!!!)

====================
<style>
body, table, tr, td {
font-family: 'verdana'
font-size: 12px;
}
td.header {
font-weight: bold;
background-color: #cccccc;
}
</style>
</head>
<body>
<br><br><br><br><center>Creating Export Files<br><br>Please be
patient.</center><br><Center>
<?
flush();
$db = mysql_connect("localhost", "stickerguy", "PASWORDHERE!");
mysql_select_db("stickerguy",$db);

// Create contact.tab which is a tab delimated list of customer
numbers names, address, email
// order write old file

// Open contact.tab
$file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/contact.tab";
$logfile = fopen($file_name, "w+") or die("Couldn't create new
file");
echo "<br>contact.tab ";
flush();

// Get all customer numbers
$results = mysql_query("SELECT DISTINCT custnumber.ID AS
customer_number, orders.custid FROM orders, custnumber WHERE
orders.custid = custnumber.scratch AND imported = 0 AND (STATUS =
'payment received' OR STATUS = 'paypal billing complete') ORDER BY
custnumber.ID", $db);

while ($custnumber = mysql_fetch_array($results)) {

$results2 = mysql_query("SELECT * from customer where custid =
".$custnumber["custid"]);
$customer = mysql_fetch_array($results2);

fwrite($logfile, $custnumber["customer_number"]." ".$customer["name"]." ".$customer["company"]." ".$customer["address"]." ".$customer["state"]." ".$customer["zip"]." ".$customer["email"]."
");

echo ".";
flush();

}
fclose($logfile);

// Create phone.tab which is a tab delimated list of customer numbers
and phone numbers
// over write old file

// Open phone.tab
$file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/phone.tab";
$logfile = fopen($file_name, "w+") or die("Couldn't create new
file");

echo "<br>phone.tab .";
flush();

// Get all customer numbers
$results = mysql_query("SELECT DISTINCT custnumber.ID AS
customer_number, orders.custid FROM orders, custnumber WHERE
orders.custid = custnumber.scratch AND imported = 0 AND (STATUS =
'payment received' OR STATUS = 'paypal billing complete') ORDER BY
custnumber.ID", $db);

while ($custnumber = mysql_fetch_array($results)) {

$results2 = mysql_query("SELECT * from customer where custid =
".$custnumber["custid"]);
$customer = mysql_fetch_array($results2);

if ($customer["phone"] != "") {
fwrite($logfile,
$custnumber["customer_number"]." ".$customer["phone"]." HOME
");
}
if ($customer["fax"] != "") {
fwrite($logfile,
$custnumber["customer_number"]." ".$customer["fax"]." FAX
");
}

echo ".";
flush();

}
fclose($logfile);

// Create order list HTML file

// Open orderlist.html
$file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/orderlist.html";
$logfile = fopen($file_name, "w+") or die("Couldn't create new
file");

echo "<br>orderlist.html .";
flush();

fwrite($logfile, "<html>
<head>
<title>Order List</title>
");
fwrite($logfile, "<style>
");
fwrite($logfile, "td {font-family: Verdana; font-size: 10px;}
");
fwrite($logfile, "td.leftbox { font-family: Verdana; font-size:
10px; background-color: #E8E8E8; }
");
fwrite($logfile, "td.box1 { font-family: Verdana; font-size: 10px;
background-color: #CCCCCC }
");
fwrite($logfile, "td.box2 { font-family: Verdana; font-size: 10px;
background-color: #EEEEEE; }
");
fwrite($logfile, "</style></head><body>
");

// Get list of all needed customer numbers for order list
$results = mysql_query("SELECT DISTINCT custnumber.ID AS
customer_number, custnumber.grandtotal, orders.custid FROM orders,
custnumber WHERE orders.custid = custnumber.scratch AND imported = 0
AND (STATUS = 'payment received' OR STATUS = 'paypal billing
complete') ORDER BY custnumber.ID", $db);

// Loop thru customer number building table each time
while ($custnumber = mysql_fetch_array($results)) {

$results2 = mysql_query("SELECT * from customer where custid =
".$custnumber["custid"]);
$customer = mysql_fetch_array($results2);

$results3 = mysql_query("select * from orders where custid =
".$custnumber["custid"]);
$order = mysql_fetch_array($results3);

fwrite($logfile, "<table cellspacing=2 cellpadding=2 width=750
height=185 border=0>
");
fwrite($logfile, "<tr>");

fwrite($logfile, "<td rowspan=3 class=leftbox
valign=top><b>Customer
#".$custnumber["customer_number"]."</b><br><br>".$order["orderdate"]."<BR><BR>".$customer["name"]."<br>".$customer["address"]."<br>".$customer["city"].",
".$customer["state"]."<BR>".$customer["zip"]."<BR><BR>".$customer["email"]."<BR>ph:
".$customer["phone"]."<br>fx: ".$customer["fax"]."</td>
");

fwrite($logfile, "<td class=box1>
");

fwrite($logfile, "<table cellpadding=2 border=0 width=100%>
");

fwrite($logfile, "<tr>
");
fwrite($logfile, "<td><b>Payment Method:</b></td>
");
if ($order["status"] == "paypal billing complete") {
fwrite($logfile, "<td>Pay Pal</td>
");
}
if ($order["status"] == "payment received") {
fwrite($logfile, "<td>Check/Mail</td>
");
}
fwrite($logfile, "<td><b>Payment Amount:</b></td>
");
fwrite($logfile, "<td>$".$custnumber["grandtotal"]."</td>
");
fwrite($logfile, "</tr>
");

fwrite($logfile, "<tr>
");
fwrite($logfile, "<td><b>Requested Deadline:</b></td>
");
fwrite($logfile, "<td colspan=3>".$order["deadline"]."</td>
");
fwrite($logfile, "</tr>
");

fwrite($logfile, "</table>
");

fwrite($logfile, "</td>
");

fwrite($logfile, "<tr><td class=box2>
");

fwrite($logfile, "<table cellpadding=2 border=0 width=100%>
");

$results4 = mysql_query("select * from orders where custid =
".$custnumber["custid"]);
while($orders = mysql_fetch_array($results4)) {

fwrite($logfile, "<tr>
");
fwrite($logfile, "<td><b>".$orders["project"]."</b></td>
");
fwrite($logfile, "<td>".$orders["quantity"]."
".$orders["ordertype"]." ".$orders["size"]."</td>
");
fwrite($logfile, "<td>
");
if ($orders["vinyl"] != "") {
fwrite($logfile, "Vinyl: ".$orders["vinyl"] . " "); }
if ($orders["color1"] != "") {
fwrite($logfile, "Color1: ".$orders["color1"] . " "); }
if ($orders["color2"] != "") {
fwrite($logfile, "Color2: ".$orders["color2"] . " "); }
if ($orders["color3"] != "") {
fwrite($logfile, "Color3: ".$orders["color3"] . " "); }
if ($orders["color4"] != "") {
fwrite($logfile, "Color4: ".$orders["color4"] . " "); }
fwrite($logfile, "</td>
");
fwrite($logfile, "<td>Artwork ".$orders["os"]."
".$orders["software"] . " " . $orders["filename"] . "</td>
");
fwrite($logfile, "</tr>
");
}
mysql_query("update orders set imported = 1 where custid =
".$custnumber["custid"]);

fwrite($logfile, "</table>
");

fwrite($logfile, "</td></tr>
");

fwrite($logfile, "<Tr><td class=box1>" . $customer["notes"] .
"</td></tr>
");
fwrite($logfile, "</table>
");

fwrite($logfile, "<hr color=black width=750>
");

echo ".";
flush();

}

fwrite($logfile, "</body></html>");

// Output links to each of the above 3 files.
?>
</center>
<Br><br>
<center>
<a target="new" href="contact.tab">contact.tab</a><br>
<a target="new" href="phone.tab">phone.tab</a><br>
<a target="new" href="orderlist.html">orderlist.html</a><br>
<Br><br>
Right click the above links and click "save as" or "save target as" to
save the files. <Br><Br>
Orders have been marked as processed.

</center>
</body>
</html>

View Replies !
PHP Slow To Execute
I have some PHP pages at.. which is exhibiting
some strange slowness. It is hosted by secureserver.net (bad?).

When I time how long it takes to load the main web page from the
server
it averages 7 seconds, but often goes to 15.

When I store the main page on my hard drive, the load time is 1
second.

I've tried removing PHP code that might slow things down
but that only brings the load time down to 5.5 seconds best case.

I have other PHP pages on the same server that seem to execute
faster. The key difference between the slow main page and the faster
pages is the faster pages do not use "include" to execute code in
other
PHP files.

However with out "include" and the modularity it affords, my PHP code
would be harder to maintain. What to do?

View Replies !
MSSQL Slow On IIS 6
I built a PHP website on Windows 2000 (using IIS) that connects to a
SQL Server 2000 database using the mssql functions. I migrated the
website and the database onto a Windows 2003 machine, and now the mssql
functions are significantly slower. On the Windows 2000 machine, the
mssql_connect takes .03 seconds to run, and the odbc_connect takes the
same amount of time. On Windows 2003, the mssql_connect takes a full
second to run, but odbc_connect only takes .017 seconds. I have tried
both ISAPI and CGI for the php configuration in IIS, and I have
experimented with different values for the output_buffering parameter
in php.ini, but neither of these seem to make a difference. Why would
the mssql commands be so much slower on IIS 6? I would rather not have
to change all the database calls to be odbc instead of mssql

View Replies !
Is_null Very Slow
I recently loaded a binary copy (5.0.3) onto my PC
running win2k and Apache 2.0.52.
It seems to work fine except that it is very slow running the function
is_null e.g. the dummy program below -
<?php
for($i=0; $i<1000; $i++) {
if(is_null($x)) $y=0;
}
echo 'done'
?>

View Replies !
Website Too Slow
I'm re-programming my Website (www.coaster.ch) in PHP and I find it too
slow (although I have ADSL).
That's more or less how it functions:
Here my tables:
'COASTERS' (code of coaster, code of country, etc...)
'COUNTRIES' (code of country, names of countries in different
languages, code of continent)
'CONTINENTS' (code of continent, names of continents in different
languages)

In my index.php (start site) I use a "while":
I look for the first continent.
I look for the first country
I count all the coasters from 1st country
echo country - number of coasters
I look for the second country
I count all the coasters from 2nd country
....
....
I look for last continent....

The search and presentation in tables (I use 5 tables, 1 for each
continent) is rapid.
The problem is when I go the the sub-site of a country and want to come
back to the index site: it takes too much time.
Could it be that it is slow because it has to make the whole search
again?
Can I solve that by making the first search (at the begin of the
session with something like requireOnce "search data) and charge all
the information in an array and them when returning from a sub site
only showing the array?
I also thought that perhaps the reason could be that I use tables for
continents and countries but otherwise I should have to include all
these texts in .inc files...


View Replies !
Fread Is Slow, Is There A Better Way?
I have been trying to stream a 19mb quicktime file through PHP. While this script does work i find it to be really slow. Is there any way i can make it faster? I have tried using fpassthru and using a smaller buffer and neither seemed to have much effect. Code:

View Replies !
Getimagesize Too Slow
getimagesize function work so slow, is there a fast way to get the image size ?

View Replies !
Slow Mail()
I have a script with a mail() command to send an email to myself to inform user's ip and referrer. I've been using it without any problems for the last three years. Big changes I had to make in many scripts when I turned register_globals off. After this, access to that page (script) is very slow (1-2 minutes) unless I comment mail() out. I cannot figure out what should I set to fix it ....

View Replies !
Apache2 W2K Slow
I do PHP programming on a Windows 98 computer, (why 98 - well I want to run VBDOS on this computer). I then transfer PHP files to a W2K computer. I recently moved to Apache2 and PHP 4.3.11 (from 4.1.3). One page in particular has some fairly intensive work to do, accessing MySQL a lot and creating two large tables. This page takes 2 1/2 times longer to load on the W2K server than the W98 server.

I have done timings for various parts of the page using mictotime. All parts are slower on W2K. Both servers are using the same PHP.INI file. Globals has to be on as some of the programs still need it, not yet converted. Anyone has similar experience?

View Replies !
Fsockopen Slow
I'm having an issue with speed at the moment. Basically I have a database with a list of websites on it. I only want to display the sites that are actually 'live'. I've used fsockopen and it does work. Only problem is it takes quite a while.

I seem to be waiting at least 10 seconds for it to tell me the site is not responding. It is very quick when the site does exist though. I've played with the optional timeout from fsockopen but I see no difference. Any suggestions? Is there another faster way to check a site is online using php?

View Replies !
Gethostbyname Slow
using the gethostbyname function seems to noticeably slow down pages. some of the comments in php.net's gethostbyname entry suggest using a version that caches the result, but those versions also only speedup subsequent calls to gethostbyname - the first call is still as slow as ever. so is there anything i can do to speed this up? perhapes i can just implement a function equivalent to gethostbyname using fsockopen, or something?

View Replies !
PHP Slow On Solaris
Does anybody knows why php runs so damm slow on solaris. PHP works fine, but if you use the array function it get really slow. everyone could try it on different platforms.

fill a array with 100.000 elements in a loop and you will see what i mean. debugger output shows that php ist trying to get memory for each element. --> anybody know how to tune this in solaris or php? Code:

View Replies !
Database Slow
A reporting script is run from the command line that takes about 45 minutes to run against the production database. Towards the end of run of the script, the database becomes heavily loaded and starts to affect other applications using that databaes.

How to approch debugging that script?

View Replies !
Slow Site
My site starts loading very slow. At first I thought that this is host problem, but now I have moved to another host, which should be much faster. Then I start thinking that I have problem in my code. So I start measuring time at the very first header and at the bottom of the page (footer). PHP Code:

$today = date("H:i:s");

The difference between header and footer was only 5 secunds. So I figure it out that you have to wait over 20 secunds just to start loading PHP code. Please I could use any tip to improve speed.I'm using PHP and SQL.

View Replies !
Slow Query
i have this query that will only return members that user "1162828" hasnt already voted for. the reason behind this is so user "1162828" does vote on the same member more then once.

my problem is that it is slow and gets recored to my slow logs. anyone know why this might be slow? Code:

View Replies !
Slow SQL Queries
I have been trying to clean up my SQL queries, and am stuck on something very simple. This query:

select * from ds_products where catID = ôƒ' or cat2ID = ôƒ'

I have both catID and cat2ID indexed, but this query does not use either. EXPLAIN shows that id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE ds_products ALL catID,cat2ID NULL NULL NULL 23378 Using where

key = NULL.

View Replies !
Help My Slow Parsing Code!
Here's my situation...I've been learning to write PHP for awhile and have been trying to rewrite my web site from plain old static pages to PHP versions. I've been learning based on what I want to do, put my links and articles in databases and allow comments and ratings.

I have a test page here:
URL

I've managed to write the PHP code to do just about everything I wanted, but it takes about 3+ seconds for the page to start to load (and it didn't when it was a static page). I know that this is because of my badly formed PHP no doubt. The routines do what I want, but there HAS to be a much more efficient way to get it done.

I'm going to post the code (stipped of font tags and error catching statements). Please advise the easiest way to streamline this code (and or SQL statements) in the best interest of the server processing time (any help would be great!):

<?php
//Start of routine for animation links
$usr = "user";
$pwd = "pw";
$db = "db";
$host = "host";

$cid = mysql_connect($host,$usr,$pwd);
?>

<?php
//We want the Animated Gif category
$category = "1";

$SQL = " SELECT * FROM links_temp";
$SQL = $SQL . " WHERE category = '$category'";
$retid = mysql_db_query($db, $SQL, $cid);

//Throw the links in an array - html table loop
print ("<center><table cellpadding=2 cellspacing=0 width=100% border=1>
");
while ($row = mysql_fetch_array($retid)) {
$siteurl = $row["siteurl"];
$sitename = $row["sitename"];
$description = $row["description"];

//cocatenate together anigif_ with each item id for unique rating value
$id = "anigif_";
$id = $id . $row["id"];

print ("<tr><td width=100% valign=top>");

//Lets start the form here for the voting to elimate a line break later
print ("<form method="POST" action="/test/rating4.php" onsubmit="return genwin()" target="newwin">
");
print ("<A HREF='$siteurl' target=_blank>$sitename</A>");

//While in the while loop lets start another db connection to get item ratings
$usr3 = "user";
$pwd3 = "pw";
$db3 = "db";
$host3 = "host";

$cid3 = mysql_connect($host3,$usr3,$pwd3);

$SQL3 = " SELECT * FROM ratings_temp WHERE item = "$id"";

$result3 = mysql_db_query($db3,"$SQL3",$cid3);
$num_rows = mysql_num_rows( $result3 );
if ($num_rows==0) { echo ("No Votes yet"); }
else {
print " $num_rows Votes, ";
$SQL4 = "SELECT AVG(value) AS avgRating FROM ratings_temp WHERE item = "$id"";
$result4 = mysql_db_query($db3,"$SQL4",$cid3);

print "Rating: " . mysql_result($result4,0) . "<br>";
}
mysql_close($cid3);
//end of the db connection for ratings

print ("$description<br>
");

print ("Vote for this Site!
");
print (" <select name="rating" size="1">
");
print (" <option value="5" selected>5 - Superb
");
print (" <option value="4">4 - Tasty
");
print (" <option value="3">3 - Average
");
print (" <option value="2">2 - Bland
");
print (" <option value="1">1 - Rotten
");
print (" </select>
");
print (" <input type="hidden" name="item_id" value="$id">
");
print (" <input type="submit" value="Vote">
");
print ("</form>
");
print ("</td></tr>
");
}
//end of the array subroutine making table rows

print("</table></center>");
//end of the table after the array ends
?>

View Replies !
Session_start Is Slow Occasionally
I have a site that is relatively high loaded (~200000 reloads/sec) and i am trying to optimize it.

So i have started timing sections of the php scripts to find out which is the slowest so i optimize it first. I write the times to a database( timings are done on the live server). So now when a user reloads the page (timings are set on only one of the pages) i write to the database how long it took and how long different sections take. That way i noticed thar occasionally that page takes extremely long to generate (there are occasions of > 300sec), but generally it takes between 0.05 and 0.2 sec to generate. I started moving the sections to determine where the problem lies and it turned out that these three lines take that long from time to time:...

View Replies !
Slow Reading From Socket
I am writing a script that connects to somekind of telnet server, and
returns the answers the server gives.

Everything works fine until I have to start writing a loop. I want to give a
command which will give an answer of more than 1 line, but I do not know how
many lines it will be in total.

So I wrote something like this:
// get the list
fputs ($fp, "list all");
$list = "1";
while (!$list=="") {
$list = fgets($fp, 50);
echo "$list<BR>";
}

I tried also a few other loops like "while ($i < 100) or while(!feof) etc.
but they take over 40 seconds to show 4 lines of text.

But if I would do something like:

fputs ($fp, "list all");
$line1 = fgets($fp, 50);
$line2 = fgets($fp, 50);
$line3 = fgets($fp, 50);

etc.

It is ready within a second. Anybody knows how I can speed this up? I
already tried other functions like fread, fpassthru, all worked, but as
evenly slow.

Who can help me out?

View Replies !
Awfully Slow Mysql Script
Afternoon all. I wrote a simple script to grab some information from a database. It goes like this:

- usual connection code -

Order the database by the 'desc' column:
$query="SELECT * FROM images ORDER BY `desc` DESC";

- get result, set num_rows etc. -

$i=0;
while ($i < $num_rows) {

$desc=mysql_result($result,$i,"desc");

if( $desc == $lastdesc ) { }
else {
$albumid=mysql_result($result,$i,"albumid");
$filename=mysql_result($result,$i,"filename");
$title=mysql_result($result,$i,"title");

echo "<div class='imagethumb'> <a href='/fanart/artist.php?a=$desc' class='image'> <img src='/fanart/$albumtitle/image/thumb/$filename'> </a> <center><i>$desc</i></center> </div>";

$lastdesc = $desc;
}

$i++;
}

What this does is first simplyoutput the row's data into a nice image thumb. On that first run through, it sets $lastdesc to be the same as $desc.

Then it moves on to the next row - and using $lastdesc, checks whether it has the same 'desc' as the last row, in which case it won't display as I only want one row to show for each desc.

Then it moves on to the next row and checks again. If the desc is still the same, it'll skip through until it finds a new 'desc' and output that in the image thumb. After that it's off again to repeat.

It works perfectly fine, but it's terribly slow - takes minutes just to get through 200 rows. Any ideas on optimisation? Have I gone about this in totally the wrong way?

View Replies !
Slow Mail() From Form
I have a simple form where I am sending the form results back to the submiter and form some reason the script will take up to a minute to complete it's submission. Here's the code I'm using: Code:

View Replies !
Using Session_start() And The Page Get Very Slow
when I try to use the session_start(); at top top of my page, the page loading gets very very very (!) slow. I just cant understand why. here is my code (when I dont use session_start(), its all working normal) PHP Code:

View Replies !
Php - Header Location Very Slow
I have a problem after a client clicks a Confirm button on a
form - the form processes the data, inserts into a database, and then
redirects using header Location.

I have tested this on two different Linux/Apache servers. One works
perfectly, the other takes about 90 seconds to redirect.

Has anyone seen this issue before ?

It uses a function like this :

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCE SS, &#391;', 'SSL'));

function tep_redirect($url) {
if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We
are loading an SSL page
if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { //
NONSSL url
$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); //
Change it to SSL
}
}

header('Location: ' . $url);

tep_exit();
}

In my tests - I'll receive the confirmation email *beofre* I see the
success page in the browser!

View Replies !
Does Php-cgiwrap Slow Things Down?
If we use php-cgiwrap, is there any kind of performance hit? Will it take
PHP scripts longer to start up or to run?

View Replies !
Display Data From Db Is Slow
I am trying to pull data from my database from 2 different tables and it seems to slow the page down a lot the way I did it. I was hoping someone can show me a better way to do the same thing but with faster page generation time. Code:

View Replies !
Slow Loading Page
Have a website using a mysql database with php pages created to add to fields in the database.  One of the pages has recently started to take minutes to load and when I go to 'save' changed info to be loaded in to the database, it takes up to 20 minutes ... times out and often does not save the changes.

View Replies !
Slow Down Local Transfer?
I am trying to test a loading bar, but I am running it off my local apache server, which means there isn't any real load time. Is there some way to lock my transfer rate at like 10kbs or something?

View Replies !
Debugging Slow Sites?
In my new job I have inherited quite a large and complex (an in a few places badly written) PHP & MySQL website. It also handles a lot more traffic than I have been used to in my other jobs.

The problem I have now is chasing down performance bottlenecks and slow queries, and other glitches that cause the site to hang, be unavailable or have weird load average / memory usage spikes on the webservers and the mysql servers

I was wondering what other people use for sniffing out these problems, I was thinking about Zend platform, but that is looking like it might be too expensive (we are mostly advertisement funded, so margins are low despite high traffic).

View Replies !
MSSQL Slow Performance
For a couple years now I've been running PHP 4 (cgi) with SQL Server 2000 On Windows 2000 Server and it has been running well. This past week I finally decided to upgrade to Windows 2003 and PHP5 (isapi), and while it's working I've noticed pages which hit the database load very slow, however it loads perfectly fine on the local machine.

If I try loading a page from another system on my network it loads incredibly slow, taking upwards of two minutes where it used to take seconds. Judging from the timeout errors in the logs it's happening to a lot of other people too, so I bumped the script timeout from 30 seconds to 5 minutes. While that fixes the error messages, it's still slow. has anyone heard of a problem like this before? I tried switching to the CGI module but then all my database connection strings stop working, so now I have no idea what to do.

View Replies !
Two Slow Substr() Performance
i looped bellow code around 100 times and the results are following. each reaults are millisecond.

is the substr takes much performance? and don't know why the time it takes getting fast lineally. can anybody suggest better function or way instead of substr function. Code:

View Replies !
PEAR Services_Weather Is Slow
Does anyone else use this package for PEAR? It's a great class, but it runs extremely slow. I have a feeling the reason is it has to FTP to the NOAA server to grab the data (this is for the METAR service).

Has anyone else encountered this? Is there any way to resolve it?

I don't know much about the other services (Ejse, Weatherdotcom), perhaps those are better than METAR?

View Replies !
Row Count With Slow Queries
I have a table with 500K rows and 600 cols. I can run simple sort and search queries but when I count number of rows before the limit, then get the rows with limit, the script times out. What's the best way to get a row count? Do you use mysql_free_result after each query change?

View Replies !
Site Loading Slow
I see the site loading very slow. and some times i get an error saying " connection timed out". Is there any free third party tool available to check the page loading time and which will email me.

View Replies !
MySQL Is Extremely Slow... Sometimes
I have some scripts that make 50+ queries to my SQL database. The speed is not very fast, as expected... but sometimes it takes forever, or cannot complete without a page timeout. It is strange, sometimes it goes fast... other times it cannot run at all for days.

I have recently switched my webhost to iPower.com, and I seem to have more of these problems then before.

My question is, can this be helped by switching to another provider or by getting a different class of webhost service?

I have made the assumption that it is not my script that is the problem, because it has not changed. I figure it must be the webhost.

View Replies !
My Code Is Too Slow, How Do I Speed It Up?
The following function is way too slow. If anyone has any suggestions
about how to speed it up, I'd be grateful for them. We have to call
this function 36 times on one page, and I think each time it takes half
a second, so it adds up to maybe 18 seconds, which is a lot when you're
showing software to a client. The reponse we get is "Why is it so
slow?" Code:

View Replies !
Script Is Slow Before Sessions Are Set
As the title states, I have a script thats terribly slow on the initial visit, however after the sessions are set its fairly fast, or faster. But how can I set it up to run faster on the initial visit? Below is the code. I am using DreamWeaver to develop my scripts, and I cant find where to disable "Smart Tabs"

View Replies !
Slow Mail Script
I am using the mail() function to send email to my list, but ive notice it has slowed and it seems to take 1 min per email in a simple foreach loop? any ideas? the size of the email list is small, about 1000 emails.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved