PHPのssh2_execを用いて、
1秒ごとにランダムな値を出力するC言語のプログラムを
実行した時の出力を常時(または、最新の出力)取得したいのですが、
phpにアクセスすると待機中となり表示されません。
~~考えたこととしては、C言語内のfor文をphpでのfor文に変更することです。
~~
ご教示願います
PHP
1<?php 2define("TEST", "/usr/bin/sudo /home/pi/test"); 3define("ADDRESS", "127.0.0.1"); 4define("USER", "pi"); 5define("PASSWORD", "xxx"); 6 7/* SSH2 module processes*/ 8$sconnection = ssh2_connect(ADDRESS, 22); 9ssh2_auth_password($sconnection, USER, PASSWORD); 10 11/*execution command*/ 12$command = TEST; 13$stream = ssh2_exec($sconnection, $command); 14stream_set_blocking($stream, true); 15$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO); 16echo stream_get_contents($stream_out); 17?>
あなたの回答
tips
プレビュー