I've thought about doing it queue style. However, I was hoping to find a more synchronous style. Something where the original API call can return the results (success/fail) of the executed shell script. Doing what Trevyn Meyer suggested would most likely work, but we were hoping for the execution to happen as the API call comes in rather than having the result of the queued process happen up to 1 minute later (assuming a cron running every minute). Also note that this API would not be used by many. So the API calls would most likely come at most 2 - 3 times a day. Very minimal traffic. We'd just prefer the process to be more instantaneous, which is why I was thinking something like Node. What Chris London described is basically what we're looking for.
Hopefully that helps clear things up a little more. Apart from a cron or an ever running shell script, is anyone aware of alternatives or existing methods to accomplish this? If not, I'll probably see if the way Chris described would work for us, if not, then we'll probably end up with a cron that processes a db queue. Thanks everyone for the input so far! :) - David On Mon, Dec 16, 2013 at 3:15 PM, Jonathan Duncan < [email protected]> wrote: > > On Mon, Dec 16, 2013 at 2:51 PM, David Skinner <[email protected] > > wrote: > > >> tl;dr >> I have some shell scripts that I'd like to have executed based on certain >> API calls processed by PHP. How do I get PHP to execute these scripts >> while >> keeping the apache user secure? Any third party solutions? >> >> Why not try a queuing solution? Requests come in from the API and go into > a queue (db perhaps). Then an daemon script can check the queue and process > requests as needed. > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
