Hi!
Since I don't know what is causing the problem I have I was unsure in which forum to post in. Please move if in wrong.
To my problem. I'm trying to run a script on my server from a web browser. The PHP-script I did for this looks like this (running on Apache):
Code:
<?php
echo "<pre>";
echo shell_exec("/path/to/my/script.sh");
echo "</pre>";
?>
And
script.sh looks like this:
Code:
echo "password" | sudo -u user -S /usr/bin/mongrel_rails cluster::restart -C /etc/mongrel_cluster/enviroment.yml
And I guess (not sure) that the problem is that I run sudo. It works if I log in to the computer over SSH and run the script. But when executing it from the browser I'm not logged in as any user (right?), and therefore sudo cannot execute my script.
Could that be the source to my problem and how do I solve it?
Thanks!