Executing unix shell commands using PHP Running shell commands using PHP script Execute a shell command through php and display it in browser? I have already referred to the above links. But, I'm experiencing an issue in displaying the linux shell command process in the browser. My linux command: top -n 1 and wanted to display them using php in the browser..
myscript.php
<?php
$var = shell_exec('top -n 1');
echo "<pre>$var</pre>";
?>
Now, when I refresh my browser, I'm unable to see the output in the browser.