Camadas Camadas - 1 year ago 112
Apache Configuration Question

Run a shell script on PHP?

Hi I have been trying to use the shell_exec() without success don't know why.

If I use the command that I have on the shell_exec('');

$output = shell_exec('/home/steam/bin/./arkmanager status @main');

and it doesn't return the same as I run it on the console line.

Its there a way to force apache to use a specific user for that command ?!

Trying to do a small backend to restart a server/update and such without the need to go into the putty and so one.

Thanks in advance

Answer Source

apache/www-data don't have permissions to restart daemons .

For this to work you need to add apache as sudo user and allow only that partiular command to run without sudo password

in /etc/sudoers file add

www-data ALL=NOPASSWD:/home/steam/bin/./arkmanager status @main

it will work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download