Are you shure that you command in shell gives an output to stdout but not to stderr? Try to add ' 1>file_stdout 2>file_stderr' to your command to see what goes where.
Try to concatenate you $command with ' 2>&1', this will send everything to $output. You should also try to log all the lines but not only $output[0]. Functions like var_dump(), print_r(), implode() etc. will help you.