title: PHP exec does not return a string on specific programs
body: <p>if i execute this command in the shell, i can see the return string.  however, <code>exec()</code> is not returning anything.  i've also tried <code>shell_exec()</code> to no avail.  safe mode is turned off in php.ini.  the permissions on the executable are <code>rwxr-x-r-x</code>.  i've tried using the full path and the short path.  i can execute <code>ls</code> with no problems, and it returns the appropriate data but i cannot get the output from this c program i've written for some reason.  it prints to <code>stdout</code> using the <code>printf()</code> function, and, again, prints to the command line without issue, but php won't pick it up.  what gives?</p>
  
  <p><code>$string_array;<br>
  exec("/bin/weight",$string_array);<br>
  var_dump($string_array);</code></p>
  
  <p>replacing <code>"/bin/weight"</code> with <code>"/bin/ls"</code> shows a proper result.  when i execute <code>"/bin/weight"</code> in a shell, it prints <code>{motion=false,weight=0,uom="LBS"}</code> as it is supposed to, but it somehow does not make it to php.  again, in <code>php.ini</code>, <code>safe_mode = Off</code>.  pulling my hair out here...</p>
  
  <p>important bits of the c program:</p>
  
  <pre><code>//build return string and send back to stdout
  char weight_buf[32];
  char result[1024]="{motion=";
  
  if(motion==FALSE) {
          strcat(result, "false,");
  } else {
          strcat(result, "true,");
  }
  strcat(result, "weight=");
  if(negative==TRUE) {
          strcat(result, "-");
  }
  //itoa(weight, weight_buf, 10);
  sprintf(result, "%s%d", result, weight);
  strcat(result, weight_buf);
  strcat(result, ",uom=\"");
  strcat(result, "LBS");  //TODO: fill in the actual units here
  strcat(result, "\"}");
  printf("%s\n", result);
  
  return 0;
  </code></pre>
  
  <p>the above code prints to <code>stdout</code> just fine when executed from a command line:</p>