Program Randomly Stops

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chvol
Forum Newbie
Posts: 20
Joined: Fri Apr 26, 2002 2:49 pm

Program Randomly Stops

Post by chvol »

Who knows how to do any of the following (1-3)?

1. “You're going to want to run it not through the web server, but via the command line.”

2. “You can use a combination of PHP with client side code to keep the script running. Set a particular number of pages to be processed, a number lower than when you experience the timeout. As long as there are pages to be processed print a client side script, e.g. JavaScript, to reload the page. This will reload until all pages are done - then don't output the reloader code.”

3. “You are running the script from a browser. The browser receives output from your PHP script - or waits for it. Send output to the browser that triggers the reloading of the page. This makes sense when you invoke (whatever snoopy is) the class a finite number of times, e.g. 100 URLs at a time. Once the URLs are processed keep track of the number of processed URLs via a session variable. Then output some JavaScript to the browser that reloads the page. Here's an example How do I "print" a client side script?{: print "<script>document.location.reload();</script>"; Alternatively you can do it in PHP if you make sure there is no output sent before redirecting. You could use the header() function to redirect the script to itself. header("Location: ".$_SERVER['PHP_SELF']);”

Explanation:

I have written a PHP program to retrieve the HTML of the first page of search results from Google for a large file of search values. My program uses class SNOOPY http://sourceforge.net/projects/snoopy to translate the URL into the HTML. After about 100-300 references to snoopy, which takes about 5-15 minutes, it stops.

1. I start it using Internet Explorer.
2. There is no error message.
3. The program has no reference to set_time_limit.
4. max_executiontime=0 in php.ini .
5. A program that simply executes an endless for, periodically printing out the current time, runs indefinitely, which I manually stopped after 2 hours.
6. I am running it on my single PC windows 98 webserver Apache from PHPTriad http://sourceforge.net/projects/phptriad .

I received the above three answers, but I don’t know how to do those things. I program only in PHP (and HTML.) I can start up Apache webserver, write PHP programs using a file editor, and start them using Internet Explorer. I couldn’t get any further explanation.

Charlie chvol@aol.com
Post Reply