I have a PHP script that needs to run some pretty hefty imagemagick commands.
These commands may be run at the same time by multiple users, so user a, b, c, and d would all be running the same task. I want to make it into a background process, so I can use jQuery, for example, to show a loading bar during processing.
What would be the best way to accomplish this? Or, is there another method that may be easier?
There are quite some guides how to create Deamons with PHP:
http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
Or how to background a process:
http://waynepan.com/2007/10/11/how-to-use-ignore_user_abort-to-do-process-out-of-band/
You could create a deamon running in the background, reading from a database table that contains all jobs that need to be worked on and then you can check with your frontend process for that table every once in a while until all jobs have cleared for that specific process.
You can also use a message queue for that, so you can use multiple deamons in parallel (for example on multicore systems) without conflicting.