You are here: filehandling and system() permissions. « PHP Programming Language « IT news, forums, messages
filehandling and system() permissions.

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация