I'm trying to list the contents of a file on a webpage. I'm using php to do a shell_exec of a cat command. The result seems to remove all line breaks. Cat on the commandline however displays the results appropriately.
On the command line:
Code:
cat /usr/local/nginx/scripts/1data.txt
Results in the below (with line breaks):
__stream2__out1__ rtmp://myserver.com
__stream1__out4__ rtmp://server2.com
However, on the webpage, I get the same but without line breaks.
__stream2__out1__ rtmp://myserver.com __stream1__out4__ rtmp://server2.com
The webpage php code is below.
Code:
<?php
if (isset($_GET['list'])) {
$output = shell_exec("cat /usr/local/nginx/scripts/1data.txt");
echo "$output";
}
?>