ssh2 php, output not display

367 views Asked by At

I want to display my output of my js...

::php code::

<?php
$domain = 'ip';
$user = 'root';
$pass = 'pass';
header('Content-Encoding: none;');
set_time_limit(0);

$connection = ssh2_connect($domain, 22);

    if(ssh2_auth_password($connection, $user, $pass)){//If authentication is successful...
            //$h = ssh2_exec($connection, 'ls');
            $h = ssh2_exec($connection, 'cd token && npm start');
            $out = ssh2_fetch_stream($h, SSH2_STREAM_STDIO);

            if (ob_get_level() == 0)
                    ob_start();

            while (!feof($out)) {
                    $line = fgets($out);
                    echo $line.'<br />';
                    echo str_pad('', 4096);
                    ob_flush();
                    flush();
                    sleep(1);
            }

            fclose($out);
            ob_end_flush();
    }      

?>

my VPS display at exec the command

output in vps

but in web some output not display

output not display

whats wrong with my script?? I will display all of my output (sorry for noob question) thanks hope you will help me :)

0

There are 0 answers