After running your logs through
this script (it'd have been easier if you encapsulated your logs within <pre> tags)... does $ssh->exec('ls -la > /dev/null') yield the same results? I did it on my SSH server and got the following:
- Code: Select all
<- NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST (0.0477s)
00000000 00:00:00:00:00:20:00:00 ..... ..
<- NET_SSH2_MSG_CHANNEL_SUCCESS (0s)
00000000 00:00:00:00 ....
<- NET_SSH2_MSG_CHANNEL_EOF (0.0087s)
00000000 00:00:00:00 ....
<- NET_SSH2_MSG_CHANNEL_REQUEST (0s)
00000000 00:00:00:00:00:00:00:0b:65:78:69:74:2d:73:74:61 ........exit-sta
00000010 74:75:73:00:00:00:00:00 tus.....
<- NET_SSH2_MSG_CHANNEL_CLOSE (0s)
00000000 00:00:00:00 ....
tmux, on your server, yields the following:
- Code: Select all
<- NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST (0.0325s)
00000000 00:00:00:00:00:20:00:00 .....
<- NET_SSH2_MSG_CHANNEL_SUCCESS (0s)
00000000 00:00:00:00 ....
<- NET_SSH2_MSG_CHANNEL_REQUEST (0.0269s)
00000000 00:00:00:00:00:00:00:0b:65:78:69:74:2d:73:74:61 ........exit-sta
00000010 74:75:73:00:00:00:00:00 tus.....
Note how your SSH server isn't sending a NET_SSH2_MSG_CHANNEL_CLOSE whereas mine is. Because of that phpseclib is stalling, waiting for a message that's never being sent. Maybe the PECL SSH2 extension sends a NET_SSH2_MSG_CHANNEL_CLOSE after the exit-status message, I don't know.
My recommendation is this: using the
latest SVN do $ssh->setTimeout(2). That'll make it so phpseclib sends a NET_SSH2_MSG_CHANNEL_CLOSE after two seconds even if it receives no NET_SSH2_MSG_CHANNEL_CLOSE.