Restart httpd and named via PHP (without suexec/as nobody)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Restart httpd and named via PHP (without suexec/as nobody)

Post by amir »

I need to restart both BIND and Apache from a PHP script that's running as nobody. The following two lines don't work:

Code: Select all

echo `/usr/sbin/httpd restart`;
echo `/etc/rc.d/init.d/named restart`;
Anyone?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Restart httpd and named via PHP (without suexec/as nobod

Post by Chris Corbyn »

amir wrote:I need to restart both BIND and Apache from a PHP script that's running as nobody. The following two lines don't work:

Code: Select all

echo `/usr/sbin/httpd restart`;
echo `/etc/rc.d/init.d/named restart`;
Anyone?
8O

You need root to do that. No two ways about it sorry.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Why would you want to restart Apache? Most httpds i know have an option that allows you to reload (meaning: keep running, but reload the configuration file).

I have even more troubble seeing why you would want to restart Bind. Checkout the remote name daemon control (rndc).
Post Reply