One common way to trigger an action which need root from a web server or other non priviliged account is to the use of an intermediary file. Have the web server write the required to a file, for example a uniquely named file in /tmp.
Have a job run from root's crontab that reads the files and performs required actions.
You lose the interactivity ("your command failed: $errormsg") but that can only be reached I think by
giving root privs to your web server, something you
really really don't want to do.