I am quite new to PHP, and i need to get the output of the command 'iocage list -h', iocage is a management tool for freeBSD. Using the code:
$file = shell_exec('/usr/local/bin/iocage list');
echo $file;
It outputs nothing, if i do:
$file = shell_exec('/usr/local/bin/iocage list 2>&1');
echo $file;
Then it outputs
Usage: iocage [OPTIONS] COMMAND [ARGS]... Try "iocage --help" for help. Error: No such command "list".
This is not right as if i run the command '/usr/local/bin/iocage list' it works as expected. I do not understand why there is a '2>&1' at the end of the command, i saw it in a an answer for a different question.
Does anyone know how to make this work? Thank you for any help in advance.