The exec() function is one of several functions you can use to pass commands to
the shell. The exec() function requires a string representing the path to the command
you want to run, and optionally accepts an array variable that will contain
the output of the command and a scalar variable that will contain the return value
<?php
exec(“ls -al .”, $output_array, $return_val);
echo “Returned “.$return_val.”<br/><pre>”;
foreach ($output_array as $o) {
echo $o.”\n”;
}
echo “</pre>”;
?>
the shell. The exec() function requires a string representing the path to the command
you want to run, and optionally accepts an array variable that will contain
the output of the command and a scalar variable that will contain the return value
<?php
exec(“ls -al .”, $output_array, $return_val);
echo “Returned “.$return_val.”<br/><pre>”;
foreach ($output_array as $o) {
echo $o.”\n”;
}
echo “</pre>”;
?>