I would recommend abandoning PHP SSH2 instead of phpseclib, a pure implementation of PHP SSH .
Among other things, the PHP SSH2 API sucks. Private keys must be stored on a bootable file system, while phpseclib all they need is a string. You can take the key from $ _POST without having to upload it to the file system, as libssh2 requires. For this, libssh2 requires that you have a separate file for the public that is dead by the brain, since the private key contains the public key.
ssh2_exec (), from libssh2, also returns ANSI color codes and sometimes never returns and sometimes does (this is inconsistent).
Finally, phpseclib is simply faster .
user734976
source share