Helping ordinary people create extraordinary websites!
   

How can I make a PHP page reload continually forever?

Wednesday, 4th November 2009
by zolo

I need to do this for a special application I am building. The following is what I have done but it stops after about 20minute. I think it runs out of memory. On the page reload1.php I have put the code:

<?php
//I have put my php code in this area. normal code that is working ok
bla...bla...bla in php!

//Now at the end of my bla.. bla... code I call (by include) the other page called //reload2.php like so;
include ("reload2.php"); //this includes relaod2.php
?>

//Now my trick is I have the same bla.bla.bla code on reload2.php and make it call relaod1.php as follows:

<?php
//I have put my php code in this area. normal that is code working ok
bla...bla...bla in php!

//Now at the end of my bla.. bla... code i call (by include) the other page called reload2.php
include ("reload1.php"); //this includes relaod1.php
?>

By doing this I hope to create an indefinite cycle of reload1.php calling reload2.php and then reload2.php calling back reload1.php. Perpetual machine? Yes!!! At the first it was working just for a few seconds. I realized I needed to change "resource limits" on the php configuration file (php.conf). I changed to below

max_execution_time = -1 ; Maximum execution time of each script, in seconds(30)
max_input_time = -1 ; Maximum amount of time each script may spend parsing ;request data(60)
memory_limit = -1 ; Maximum amount of memory a script may consume (16MB)

I changed the parameters above to -1 to make them limitless.(otherwise the default are the values show in brackets). This improved my perpetual machine to run from seconds to over fifteen minutes. But I don't want it to stop at all (unless i say so).

Windows Task Manager shows that PF (memory) usage fills up slowly untill it matches that of the available RAM, and then the whole thing stops. This happens even when an I have put nothing in the code to echo to the browser.

Please help!
ZOLO





More PHP Help:
» How can I sort an array in PHP?
» Sorting an array in ascending order
» Related to cronjob
» How to strip the querystring from a URL using PHP?
» How to create a loan eligibility calculator using PHP?
» Where can I find a script for uploading an sql file to a MySQL database server?
» How to upload a form in php?
» How to show all errors in PHP?