简体   繁体   中英

PHP Net_SSH2 returning inconsistent output

I was wondering if anyone has had this problem or maybe have an idea of what could be causing my problem

After executing the following lines of code...

 $ssh2->write("uptime\n");
 $out = $ssh2->read($prompt, NET_SSH2_READ_REGEX);

I am sometime getting all the output i expect from the command and sometime only getting half, or even less. I'm not sure why this is happening. Possible buffer/stream issue? I read somewhere about not being able to read >1000 lines...

Any help would be appreciated. Should i be using exec() instead?

Thanks

It seems my prompt was causing the issue of intermittent output length. Weird, because i thought it would be cutting short at consistent points. Oh well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM