Posted By

iroybot on 08/25/12


Tagged

php error return exec


Versions (?)

PHP Exec debugging


 / Published in: PHP
 

easy way of catching and displaying errors and return values from a exec() command back in PHP.

  1. exec("java -jar some command 2>&1 &", $return, $code);
  2. if ($code != 0) {
  3. printf("Fuck! Something went wrong: %s (%s)", join('<br />', $return), $code);
  4. } else {
  5. print("Command successful.");
  6. }

Report this snippet  

You need to login to post a comment.