You can easily run system commands in php using either 'system' or 'popen'.
Using the system command provides little control and basically dumps the raw output.
system('ls -al');
Most programs will not usually output a html formatted response, resulting in it all being on a single line.
You could capture the data using the output control functions such as 'ob_start', 'ob_get_contents' and 'ob_end_clean'. They basically redirect the output stream and allow us to capture it in a variable. We then change all the new line symbols into html br tags using the 'nl2br' function.
Personally I prefer to use popen. Here's an example to show it in action. I've written the 'popen' handling into a function which returns the outputted response as an array.