I am executing a bunch of ssh commands with php's exec. All of them seems to work correctly except one of them:
$command = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no user@127.0.0.1 "verify /md5 filename"';
exec($command, $output);
These commands are being executed on a Cisco router if that makes any difference.
The output is about 99% completed however it gets cut off at the end. I don't receive the last line at all and the second to last line always gets cut off after the 1st character. I also tried passtru and got the same results.
I've also tried adding 2>&1 to the end of the command and it made no difference. Anyone know what is going on here or have any ideas?
Here are the last 2 lines. This is what I expect:
..........Done!
verify /md5 (flash:filename) = 8743b52063cd84097a65d1633f5c74f5
I get
.
Also, running this on command line works perfectly. I have seen others with similar issues but there wasn't really any solution. This is on php 5.3.3.
I have a little more information to add to this. I created a separate script that only called the exec and this command and got the same output. This rules out any thing else in my file or the framework I'm using.
I also ran the new script from command line and it worked perfectly. Running the script in the browser however returns the bad results.
I can verify that it has something to do with how the data is being returned and those dots. The ...... must load in a way that PHP doesn't like and it thinks the command is done.