I need to execute the kdiff3 command on my desktop machine (localhost) from a PHP script (using a browser, not a command line). I gave permission to use the www data of a user running scripts to execute kdiff3 using visudo. In fact, if I log in as www data, I can execute it without any problems (sudo kdiff3 ..., it is configured to not ask for a password at all).
The problem is that I am trying to execute this command with a PHP script. I tried this:
$output = shell_exec("sudo kdiff3 -m $file.def.old $file $file.def -o $file");
and nothing happens (NULL output). If I try a non-interactive command like ls, it works:
$output = shell_exec("ls");
What's happening? Why is it impossible to execute an interactive command?
source share