PHP/Utility Function/shell exec
Running a program with shell_exec()
<?
$df_output = shell_exec("/bin/df -h");
$df_lines = explode("\n", $df_output);
for ($i = 1, $lines = count($df_lines); $i < $lines; $i++) {
if (trim($df_lines[$i])) {
$fields = preg_split("/\s+/", $df_lines[$i]);
print "Filesystem $fields[5] is $fields[4] full.\n";
}
}
?>
Using the shell_exec() Function
<?php
$output = shell_exec("ls");
echo $output;
?>