I need to execute some commands on my web server with php configured with apache.
exec("service apache2 restart", $output);
print_r($output);
output:
Array (
[0] => * Restarting web server apache2
[1] => Action 'start' failed.
[2] => The Apache error log may have more information.
[3] => ...fail!
)
My guess is it's because of permissions of php on my ubuntu! What do you suggest?
http://localhost/restartserver.php, it's going to run as thewww-datauser. By default, the www-data user does not have permission to restart the web server.