The problem isn't just that the command is failing, but it's that you don't know how it's failing. exec()
doesn't give you a whole lot of information by itself, so you'll need to capture the command output (including standard error):
$output = array();
$retcode = 0;
exec('radzap -x -N 192.168.0.1 localhost secret 2>&1', $output, $retcode);
echo "Return code: $retcode\n";
print_r($output);
This gives you the command's return code and output, allowing you to see why the command is failing. There are too many possible problems to give you a specific answer.
Having said that, the most common reason for commands failing is that the binary can't be found, due to the $PATH environment variable. Try specifying the absolute path to radzap
in exec, e.g. /usr/bin/radzap
.