1

I have a line of code that needs to be executed from an user-defined start time to an user defined end time.
The problem is that a normal loop from start to end doesn't work because PHP gives me an error of "Execution Time Limit Exceeded".
How do I get this done without using CRON jobs? (I need to run my server on a Windows PC)

Mayur Birari
  • 5,837
  • 8
  • 34
  • 61
Kanishka Ganguly
  • 1,252
  • 4
  • 18
  • 38
  • You would need something sitting there checking the time and firing code if a specific time is hit. Use C#? – Chris Nov 25 '12 at 14:44
  • 1
    What about this for PHP.. http://www.phpclasses.org/package/4140-PHP-Database-driven-PHP-job-scheduler-like-cron.html – Chris Nov 25 '12 at 14:46
  • 1
    Maybe your problem isn't really the problem. Maybe if you tell us more detail about why you are trying to do this, and what you are trying to do, someone can give you a better solution. – Buttle Butkus Nov 26 '12 at 09:24

3 Answers3

3

Windows or not it's not excuse. Any platform features tools to let you do scheduled tasks. So does Windows. Here is tutorial about setting up Scheduled Tasks on Windows to achieve same results like you can with cron.

EDIT

I need to do this on a web-browser. It needs to be platform independent.

You can't really. The only trick to do something close to cron w/o cron is to check dates on each request users made to your scripts and if the time is right, fire do some job. But if noone visit your site then you start nothing.

Other option is to setup cron which would do the request to your page (i.e. using wget, lynx, HEAD etc). But it still needs the "driving force" like cron or equivalent

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

Try to change your "Execution Time Limit" in your PHP.ini

keegzer
  • 383
  • 1
  • 4
  • 15
0

I solved the problem. Using javascript and the setTimeout() function, I sent a GET request to the necessary php script and the line of code was executed after that delay.

Kanishka Ganguly
  • 1,252
  • 4
  • 18
  • 38