Hi all,
I am writing a PHP script that executes shell commands on a linux machine. When I run this script on Linux system, it waits while it executes the command and store the result in a PHP variable. But when I run it on a web browser, the browser don't wait to get result of the command execution and moves on. I want that browser to wait 2 seconds while it executes that command. How can I do this. Please help me.
The PHP Code is as under:-
<html>
<body>
<?php
$cpu=exec('top -d 1 -n 1|grep Cpu | tail -n 1 | cut -c 25-33');
echo "The Current CPU Utilization is ".$cpu;
<?php
$mem=exec('top -n 1|grep Mem');
echo $mem;
?>
</body>
</html>