i want to run a php program constantly in the server which would download some things and store them..
I was thinking of creating a script and running that in cron..
But i wonder is there any other simple method or light weight component which takes less memory in the server while running continuously ??
I thought of another simple thing,
creating a php script with infinite max_execution time and running the code inside a while(true) loop (indefinite loop) with some sleep and then starting the program using php..
Which would be the better available method to do this?
I’ve created a library called LooPHP which helps abstract out all the
while(1)craziness and provides the ability to add event sources (more or less it’s a basic runloop you’d fine in GLib, Cocoa, node.js). There’s a few of examples which can let you know if you like the style of writing (event based vs loop driven).I’d suggest reading some of the other questions with
PHPanddaemontags. Here is a few of my answers.But honestly CRON is fairly lightweight and unless it needs to be real-time (or whatever that means to you) writing PHP into a daemon is more work than it’s work.