SSH2 is a module in PHP, it is to log on to the remote host to operate
But now about its Chinese text is very little, can only understand a little, record a little, and gradually improve
Ssh2_connect ($host, $port);
Ssh2_auth_password ($resource, $user, $password); Password Authentication method
Ssh2_sftp ($resource); Generate SFTP Handle
Ssh2_scp_send (); Similar to SCP command
Ssh2_exec ($resource, $cmd); Execute command
Ssh2_sftp_stat ($resource _sftp, $dir); View Catalog
Ssh2_sftp_mkdir ($resoruce _sftp, $dir); Create a Directory
There are some connetc handles, and some are SFTP handles,
Ssh2_exec () has a return value, and its return value is unformatted (no wrapping), but it is returned as a stream (stream).
Displayed, this can be streamed:
Stream_set_blocking ($stream, true);
Echo:stream_get_contents ($stream);
Using PHP to login to SSH remote host, rather than using putty and other terminal commands flexible, so encapsulated some functions used for common operations, such as:
Ssh_sftp_mkdir () et cetera
PHP ssh2 Function Learning