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?

Member Avatar for LastMitch

Does anyone know how I can get the memory a few times while the program I ran with make run is running?

I'm not sure if you find a solution for this. In the future try to post the whole code.

Read this:

http://php.net/manual/en/book.ssh2.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.