Hey guys, I have a web app that has a javascript front end, a php back
end. The javascript calls the php function which queries a database,
and sends the information from the database, in string form, back to
the javascript, which parses the string and displays the info. This
works great until the data returned from the php script reaches a
strlength of about 500,000 or so. Then it doesnt return anything, or it
returns this message.
Code:
D4 Date: Wed, 06 Dec 2006 21:25:45 GMT Server: Apache/2.0.52 (Unix)
mod_ssl/2.0.52 OpenSSL/0.9.7d DAV/2 PHP/5.0.4-dev X-Powered-By:
PHP/5.0.4-dev Keep-Alive: timeout=15, max=97 Connection: Keep-Alive
Content-Ty 0
here's the relevant bits of code:
the javascript function
Code:
if(searchablerequest)
{
postDataReturnText("./phpscripts/searchDB.php",'data='+passedstring,
doDisplayResults);
var loading = document.createElement('DIV');
loading.id = "loadingdiv";
loading.innerHTML = "Loading Search Results...";
loading.style.width="200px";
var results = document.getElementById("results_div");
results.appendChild(loading);
}
heres the ajax function
Code:
function postDataReturnText(url, data, callback)
{
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest)
{
XMLHttpRequestObject = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
XMLHttpRequestObject = new
ActiveXObject("Microsoft.XMLHTTP");
}
if(XMLHttpRequestObject)
{
XMLHttpRequestObject.open("POST", url);
XMLHttpRequestObject.setRequestHeader('Content-Type','application/x-www-for m-urlencoded');
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200)
{
callback(XMLHttpRequestObject.responseText);
delete XMLHttpRequestObject;
XMLHttpRequestObject = null;
}
}
XMLHttpRequestObject.send(data);
}
}
heres the relevant bit of php code
Code:
while($row = mysql_fetch_array($result, MYSQL_BOTH))// add all the
individual row info to the return string
{
$feedback.=$row['CaseID'].$delimiter2.$row['CaseTitle'].$delimiter2;//for
mail subject line
$color = getCrispColor($row);
$feedback .= $color.$delimiter2;
if($all_columns_flag)
{
foreach($columnlist as $value)
{
if($value != "CaseHistory")
{
$feedback.=$row[$value].$delimiter2;
}
else $feedback.=$row['CaseID'].$delimiter2;
}
}
else
{
for($i=0;$i<$count2;$i++)
{
if($columns_to_display[$i] != "CaseHistory")
{
$feedback.=$row[$columns_to_display[$i]].$delimiter2;
}
else $feedback.=$row['CaseID'].$delimiter2;
}
}
$feedback.=$delimiter;
}
$n = strlen($feedback);
$feedback = substr($feedback,0,$n-3);
echo $feedback;
and heres the javascript function that handles the php results
Code:
function doDisplayResults(results)
{
alert(results);
}
like i said when the strlength in the php is over 500,000 or so,
nothing gets passed to doDisplayResults . And it returns pretty fast
with nothing as the result. This leads me to believe that the there is
a limit set somewhere in my setup that puts a block on a string return
that large. However, I've looked and looked at my
httpd.conf/php.ini/appcode till my eyes are bleeding. Something else
outside my knowledge is going on here. Any suggestions for alternate
lines of investigation i could try?
Sincerely,
Q
Can you call this file directly and does it load? Sounds like your server
has a limit on the size of a file it can serve up to me.
Eric
On 12/12/06, Quakerstate79 <akoele@gmail.com> wrote:
> Hey guys, I have a web app that has a javascript front end, a php back
> end. The javascript calls the php function which queries a database,
> and sends the information from the database, in string form, back to
> the javascript, which parses the string and displays the info. This
> works great until the data returned from the php script reaches a
> strlength of about 500,000 or so. Then it doesnt return anything, or it
> returns this message.
> Code:
> D4 Date: Wed, 06 Dec 2006 21:25:45 GMT Server: Apache/2.0.52 (Unix)
> mod_ssl/2.0.52 OpenSSL/0.9.7d DAV/2 PHP/5.0.4-dev X-Powered-By:
> PHP/5.0.4-dev Keep-Alive: timeout=15, max=97 Connection: Keep-Alive
> Content-Ty 0
> here's the relevant bits of code:
> the javascript function
> Code:
> if(searchablerequest)
> {
> postDataReturnText("./phpscripts/searchDB.php",'data='+passedstring,
> doDisplayResults);
> var loading = document.createElement('DIV');
> loading.id = "loadingdiv";
> loading.innerHTML = "Loading Search Results...";
> loading.style.width="200px";
> var results = document.getElementById
> ("results_div");
> results.appendChild(loading);
> }
> heres the ajax function
> Code:
> function postDataReturnText(url, data, callback)
> {
> var XMLHttpRequestObject = false;
> if (window.XMLHttpRequest)
> {
> XMLHttpRequestObject = new XMLHttpRequest();
> }
> else if (window.ActiveXObject)
> {
> XMLHttpRequestObject = new
> ActiveXObject("Microsoft.XMLHTTP");
> }
> if(XMLHttpRequestObject)
> {
> XMLHttpRequestObject.open("POST", url);
> XMLHttpRequestObject.setRequestHeader
> ('Content-Type','application/x-www-form-urlencoded');
> XMLHttpRequestObject.onreadystatechange = function()
> {
> if (XMLHttpRequestObject.readyState == 4 &&
> XMLHttpRequestObject.status == 200)
> {
> callback(XMLHttpRequestObject.responseText);
> delete XMLHttpRequestObject;
> XMLHttpRequestObject = null;
> }
> }
> XMLHttpRequestObject.send(data);
> }
> }
> heres the relevant bit of php code
> Code:
> while($row = mysql_fetch_array($result, MYSQL_BOTH))// add all the
> individual row info to the return string
> {
> $feedback.=$row['CaseID'].$delimiter2.$row['CaseTitle'].$delimiter2;//for
> mail subject line
> $color = getCrispColor($row);
> $feedback .= $color.$delimiter2;
> if($all_columns_flag)
> {
> foreach($columnlist as $value)
> {
> if($value != "CaseHistory")
> {
> $feedback.=$row[$value].$delimiter2;
> }
> else $feedback.=$row['CaseID'].$delimiter2;
> }
> }
> else
> {
> for($i=0;$i<$count2;$i++)
> {
> if($columns_to_display[$i] !=
> "CaseHistory")
> {
> $feedback.=$row[$columns_to_display[$i]].$delimiter2;
> }
> else $feedback.=$row['CaseID'].$delimiter2;
> }
> }
> $feedback.=$delimiter;
> }
> $n = strlen($feedback);
> $feedback = substr($feedback,0,$n-3);
> echo $feedback;
> and heres the javascript function that handles the php results
> Code:
> function doDisplayResults(results)
> {
> alert(results);
> }
> like i said when the strlength in the php is over 500,000 or so,
> nothing gets passed to doDisplayResults . And it returns pretty fast
> with nothing as the result. This leads me to believe that the there is
> a limit set somewhere in my setup that puts a block on a string return
> that large. However, I've looked and looked at my
> httpd.conf/php.ini/appcode till my eyes are bleeding. Something else
> outside my knowledge is going on here. Any suggestions for alternate
> lines of investigation i could try?
> Sincerely,
> Q
thats what i was thinking too. I do have access to configure the
server (within reason). I'm running apache 2.0. I dont have much
experience configuring apache. Does anyone know what to look for to
see if i can get the server to serve up bigger files?
Q
-----------------------------------------------Reply-----------------------------------------------
I'd search for MAX* in the config files. MAX_EXECUTION_TIME and
MAX_UPLOAD_LIMIT (I know that's upload, but maybe there's something
related) are two I can think of, maybe there are more. I'm not used to
Apache 2 so I dunno if it's the same. But yeah, search for max and
limit and stuff like that in the config files of apache and php, but
maybe you've already consulted this line of reasoning...
Al
On Dec 13, 4:20 pm, "Quakerstate79" <akoele@gmail.com> wrote:
> thats what i was thinking too. I do have access to configure the
> server (within reason). I'm running apache 2.0. I dont have much
> experience configuring apache. Does anyone know what to look for to
> see if i can get the server to serve up bigger files?
> Q
ok, i've checked throughout httpd.conf (the apache config file) and no
dice. I can't seem to find anything related to max dowload. Does
anyone out there with experise in such matters have any light to shine
on our discussion?
Q
-----------------------------------------------Reply-----------------------------------------------
As Eric said, can you call the file directly with it passing all 500kb+
to your browser?
i.e. if you type [your domain]/phpscripts/searchDB.php?data=[data]
(maybe you need to turn this into a POST request, but you get the
idea?) will it return whatever you usually return via ajax but to your
browser's window? If so then it's obviously either a problem with the
data or your handling, if not then it's definitely the server issue.
If you have firefox I'd suggest getting firebug
(http://www.getfirebug.com/) and seeing how long it takes to load the
ajax request and what exactly is sent (if you can't do it yourself
using a url as mentioned above). It;ll show you headers and text both
ways and how long it took to receive the data. This will most probably
help you debug if it's not a server issue. When you've finally made
certain that it's definitely a server issue, then you can work out why
your server's being so selective about how much it sends because, as
you say, your server looks like it's set up fine.
Al
On Dec 14, 11:00 pm, "Quakerstate79" <akoele@gmail.com> wrote:
> ok, i've checked throughout httpd.conf (the apache config file) and no
> dice. I can't seem to find anything related to max dowload. Does
> anyone out there with experise in such matters have any light to shine
> on our discussion?
> Q
well its not passing 500,000KB, its passing 500,000 characters. I'll
try the calling it directly , and post back
Q
-----------------------------------------------Reply-----------------------------------------------
So it has the exact same behavior calling it directly, which by your
reasoning means its definitely a server issue right? Man, what should
i do?
Q
-----------------------------------------------Reply-----------------------------------------------
On Dec 15, 6:48 pm, "Quakerstate79" <akoele
@gmail.com> wrote:
> So it has the exact same behavior calling it directly, which by your
> reasoning means its definitely a server issue right? Man, what should
> i do?
Looks like a server setup issue to me, so all I can really think of now
is maybe to try contacting the 'owner' of the server. (You said you
have pretty good but not perfect access to the server so that suggests
there is an owner somewhere that may be able to help.)
Al