2

I'm using phpseclib to send top -cbn1 | grep servers/Server_1 | head -n 1 via ssh. The command works as expected in a terminal window but if i execute it with php it returns nothing. My code looks like this:

include('ssh/Net/SSH2.php');
include('../config/config.php');

$ServerID = 'Server_'.'1';

echo $ssh->exec('top -cbn1 | grep servers/Server_1 | head -n 1 \n');
Stanley Machnitzki
  • 597
  • 1
  • 4
  • 11

1 Answers1

0

There is a detailed instruction for your problem in the docs here:

phpseclib Documentation However since you limit the output to one entry i can't tell why it doesnt return anything but the docs might help you.

Stantastic
  • 102
  • 9
  • I did read about this and tried that too. However the way it outputs and the time it takes is a big problem in my case. I'll leave the question unanswered for a bit... maybe someone knows if not I'll accept your answer. Thanks – Stanley Machnitzki Feb 07 '16 at 10:52