I basically want to check if a command ran successful using shell_exec
.
Simple function:
public static function foo()
{
$command = "blabla";
shell_exec($command);
}
Edit, I tried Mister M's suggestion like this:
foreach($commands as $key => $value)
{
shell_exec($value, $output, $return);
}
And I get this error:
Undefined variable: output
Try using exec
:
$output = array();//Each line will be assigned to this array if any are generated.
$result1 = exec($command, $output, $return);
if ($return != 0)
{
// error occurred
}
else
{
// success
}