I am doing a project and I need to monitor a program I run through ssh2, I need to get info while it is running but i dont know how to do that really.
First this is my code (part of it):
$stream = ssh2_exec($con, "make run");
$data = stream_get_contents($stream);
while($buffer = fread($stream, 4096)) {
$data .= $buffer;
$mem = getMemory($con);
echo "<br/> Total: ".$mem;
}
Does anyone know how I can get the memory a few times while the program I ran with make run is running?