Page 1 of 1

the scripts restarts itself?

Posted: Wed Jul 21, 2010 8:01 am
by folo
I have a problem with a script that restarts itself after about 5 minutes or about 1000 url's crawled. It basically crawls url's and collects information, and after a while it simply restarts the main script. I have no idea why it does this.

<?php

include 'down_parse.php';
include 'static/config.php';
include 'static/opendb.php';

$result2 = mysql_query("SELECT Application_XML_File_URL FROM padentries");
if (!$result2) { echo 'Could not run query: ' . mysql_error(); exit; }

while ($row = mysql_fetch_array($result2)) {
$nn++;
echo "$nn. <b>". $row["Application_XML_File_URL"] ."</b> - ";
psite($row["Application_XML_File_URL"]);
}

mysql_close($conn);

?>

As you can see the variable $nn autoincrements itself for each url crawled. But after a while the entire script refreshes itself, clears the results on the screen and $nn starts over from 1.

Re: the scripts restarts itself?

Posted: Wed Jul 21, 2010 12:18 pm
by Jade
What's in your include down_parse.php and config.php files?

Re: the scripts restarts itself?

Posted: Wed Jul 21, 2010 1:04 pm
by folo
In the those files are the connection to teh database and the code for actually crawling and parsing the sites.

Re: the scripts restarts itself?

Posted: Wed Jul 21, 2010 2:19 pm
by Jade
My guess is that you have a redirect somewhere in those files that's causing the problem thats why I asked to see them.

Re: the scripts restarts itself?

Posted: Thu Jul 22, 2010 6:28 am
by folo
Nope, thats what is so puzzeling, there are no redirects or anything like that at all anywhere in the code of any of the scripts.
It seems be something else, like if a script executes for a very long time the browser assumes its hung and reloads it or something like that? Or the script restarts itself because its been running for "too long" something like that?

Re: the scripts restarts itself?

Posted: Thu Jul 22, 2010 8:09 am
by Jade
I've never heard of anything like that but I wouldn't totally scratch it as a possibility. What browser are you using to run it?

Re: the scripts restarts itself?

Posted: Thu Jul 22, 2010 12:23 pm
by folo
IE

Re: the scripts restarts itself?

Posted: Thu Jul 22, 2010 1:12 pm
by Jade
What you need to do is use Firefox and install the firebug add on https://addons.mozilla.org/en-US/firefox/addon/1843/

Open the firebug console and then run your script. If something is re-starting it you'll be able to see what in the console section. For all you know it could be something as stupid as some kinda spyware you aren't aware of thats running in the background. Either way firebug will show you the headers being sent out.

Re: the scripts restarts itself?

Posted: Fri Jul 23, 2010 5:42 am
by folo
Thanks! I'll give it a go.