I've got several scripts now that may run for a long time; the
self-test script for my htmlMicroscope, my serviceLog component when
it calculates totals for a large number of hits, a curl script that is
likely to one day crawl a hundred or so RSS urls in a single update,
I'd like to build a generic system (and opensource it) to allow PHP to
execute a long running script, and somehow get a progress bar with
"what am I doing now"-status-msg for such processes, in the browser.
The easiest thing, and maybe the only way this will work, is to load
up a site's framework html (so as to display the site), then call the
long-running script via ajax.
However, a long-running script needs set_time_limit(0), which is
something shared hosters just won't do for browsers.
A moderately good shared hoster will however allow you to
set_time_limit(0) for PHP cron jobs.
So I'd need to build a cron PHP daemon that listens for new tasks.
That won't be much of a problem, I've done it before.
But the task definition itself puzzles me a lot still.
I suppose I'd need an ID for the task/job, and include in the task def
what worker-php-script and worker-php-function to call, with also the
parameters for the worker function.
The worker function would then call back certain daemon functions to
push status updates to the browser.
And the browser can then just kick off the task, and poll every 5
seconds or so for very brief status updates in JSON format.
This is how I can import videos of any length into my CMS, and convert
them to flash video aswell (even optionally converting on another,
Once again I'm asking you all for input and tips before I begin on
this new workDaemon component of mine..
I suppose most of you'd want a neat PHP object of it? Not my usual
procedural-only PHP coding?
and eager to hear your tips,
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php