|
Posted by mikeisgreat@gmail.com on 04/01/06 17:48
Hi,
I am pretty new to php and have a few questions.
I am creating an Apache admin tool for some less "linux-able" users at
my job.
My tool needs to be able to 'restart' apache on 3 different servers
being that it is a cluster.
I have a shell script that I write that uses 'ssh' to accomplish this
but only if I am root or in the sudoers file.
How would I allow the user via my web tool enough privileges to restart
apache? I know I can add the 'www' user which apache is running as to
the sudoers file and explicitly allow running the 'apachectl' command,
but I don't feel safe doing this... I'm hoping someone with more
epxperience can give me some ideas.
what is the difference between using system(), exec(), shell_exec() etc
.... here is how I was thining of doing it. Of course, I still have my
perm problem.
if(isset($_POST["restart"]))
{
$restart = shell_exec('/usr/sbin/apachectl restart 2>&1'); #send
stdout/stderr to the browser
echo $restart;
}
Also, my form appends ^M end of line chars to the file. Apache is
running on RHEL 4. Is there a simple way to not let the form submission
append ^M?
Any help is appreciated.
Thanks for your time.
--Mike
Navigation:
[Reply to this message]
|