[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Apache2 restart from PHP ?



Helo,

I'm using debian etch and try to use exec command from php to restart apache2. I wrote a bash script.sh witch contain line like this:

/etc/init.d/apache2 restart

and added line
www-data ALL = (root) NOPASSWD: /var/www/script.sh

When I do:
1. # su www-data
2. $ /var/www/script.sh
apache restarting with no problems, but when I do the same using in php file

exec("/usr/bin/sudo /var/www/script.sh");

apache is going down with the message in error.log:

[notice] caught SIGTERM, shutting down

What I do wrong ?

P.S. Sorry for my poor english.



Reply to: