PHP exec() not returning output

I found that a script I was running was calling some linux functions using exec() but they weren’t always successful and I couldn’t tell why.

exec('command to run');

This would fail silently

$result = exec('command to run 2>&1', $output);

This would correctly send me back the result (in $result) and then I could do whatever with the error(s)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>