* Connect to an SSH server * @link https://php.net/manual/en/function.ssh2-connect.php * @param string $host
*
* @param int $port [optional]*
* @param null|array $methods [optional]* methods may be an associative array with up to four parameters * as described below. *
**
Index | *Meaning | *Supported Values* | *
kex | ** List of key exchange methods to advertise, comma separated * in order of preference. * | ** diffie-hellman-group1-sha1, * diffie-hellman-group14-sha1, and * diffie-hellman-group-exchange-sha1 * | *
hostkey | ** List of hostkey methods to advertise, come separated * in order of preference. * | ** ssh-rsa and * ssh-dss * | *
client_to_server | ** Associative array containing crypt, compression, and * message authentication code (MAC) method preferences * for messages sent from client to server. * | *|
server_to_client | ** Associative array containing crypt, compression, and * message authentication code (MAC) method preferences * for messages sent from server to client. * | *
* * - Supported Values are dependent on methods supported by underlying library. * See libssh2 documentation for additional * information. *
**
Index | *Meaning | *Supported Values* | *
crypt | *List of crypto methods to advertise, comma separated * in order of preference. | ** rijndael-cbc@lysator.liu.se, * aes256-cbc, * aes192-cbc, * aes128-cbc, * 3des-cbc, * blowfish-cbc, * cast128-cbc, * arcfour, and * none** * | *
comp | *List of compression methods to advertise, comma separated * in order of preference. | ** zlib and * none * | *
mac | *List of MAC methods to advertise, come separated * in order of preference. | ** hmac-sha1, * hmac-sha1-96, * hmac-ripemd160, * hmac-ripemd160@openssh.com, and * none** * | *
* Crypt and MAC method "none" *
* For security reasons, none is disabled by the underlying * libssh2 library unless explicitly enabled * during build time by using the appropriate ./configure options. See documentation * for the underlying library for more information. *
* * @param null|array $callbacks [optional]* callbacks may be an associative array with any * or all of the following parameters. *
Index | *Meaning | *Prototype | *
ignore | ** Name of function to call when an * SSH2_MSG_IGNORE packet is received * | *void ignore_cb($message) | *
debug | ** Name of function to call when an * SSH2_MSG_DEBUG packet is received * | *void debug_cb($message, $language, $always_display) | *
macerror | ** Name of function to call when a packet is received but the * message authentication code failed. If the callback returns * true, the mismatch will be ignored, otherwise the connection * will be terminated. * | *bool macerror_cb($packet) | *
disconnect | ** Name of function to call when an * SSH2_MSG_DISCONNECT packet is received * | *void disconnect_cb($reason, $message, $language) | *
* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @return bool */ function ssh2_disconnect($session) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @return array */ function ssh2_methods_negotiated($session) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param int $flags [optional]* flags may be either of * SSH2_FINGERPRINT_MD5 or * SSH2_FINGERPRINT_SHA1 logically ORed with * SSH2_FINGERPRINT_HEX or * SSH2_FINGERPRINT_RAW. *
* @return string the hostkey hash as a string. */ function ssh2_fingerprint($session, $flags = null) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $username* Remote user name. *
* @return array|bool true if the server does accept "none" as an authentication * method, or an array of accepted authentication methods on failure. */ function ssh2_auth_none($session, $username) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $username* Remote user name. *
* @param string $password* Password for username *
* @return bool true on success or false on failure. */ function ssh2_auth_password($session, $username, $password) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $username*
* @param string $pubkeyfile*
* @param string $privkeyfile*
* @param string $passphrase [optional]* If privkeyfile is encrypted (which it should * be), the passphrase must be provided. *
* @return bool true on success or false on failure. */ function ssh2_auth_pubkey_file($session, $username, $pubkeyfile, $privkeyfile, $passphrase = null) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $username*
* @param string $hostname*
* @param string $pubkeyfile*
* @param string $privkeyfile*
* @param string $passphrase [optional]* If privkeyfile is encrypted (which it should * be), the passphrase must be provided. *
* @param string $local_username [optional]* If local_username is omitted, then the value * for username will be used for it. *
* @return bool true on success or false on failure. */ function ssh2_auth_hostbased_file($session, $username, $hostname, $pubkeyfile, $privkeyfile, $passphrase = null, $local_username = null) {} function ssh2_forward_listen() {} function ssh2_forward_accept() {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $term_type [optional]* term_type should correspond to one of the * entries in the target system's /etc/termcap file. *
* @param null|array $env [optional]* env may be passed as an associative array of * name/value pairs to set in the target environment. *
* @param null|int $width [optional]* Width of the virtual terminal. *
* @param null|int $height [optional]* Height of the virtual terminal. *
* @param null|int $width_height_type [optional]* width_height_type should be one of * SSH2_TERM_UNIT_CHARS or * SSH2_TERM_UNIT_PIXELS. *
* @return resource */ function ssh2_shell($session, $term_type = null, ?array $env = null, $width = null, $height = null, $width_height_type = null) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $command*
* @param null|string $pty [optional]*
* @param null|array $env [optional]* env may be passed as an associative array of * name/value pairs to set in the target environment. *
* @param null|int $width [optional]* Width of the virtual terminal. *
* @param null|int $height [optional]* Height of the virtual terminal. *
* @param null|int $width_height_type [optional]* width_height_type should be one of * SSH2_TERM_UNIT_CHARS or * SSH2_TERM_UNIT_PIXELS. *
* @return resource|false a stream on success or false on failure. */ function ssh2_exec($session, $command, $pty = null, ?array $env = null, $width = null, $height = null, $width_height_type = null) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $host*
* @param int $port*
* @return resource */ function ssh2_tunnel($session, $host, $port) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $remote_file* Path to the remote file. *
* @param string $local_file* Path to the local file. *
* @return bool true on success or false on failure. */ function ssh2_scp_recv($session, $remote_file, $local_file) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @param string $local_file* Path to the local file. *
* @param string $remote_file* Path to the remote file. *
* @param int $create_mode [optional]* The file will be created with the mode specified by * create_mode. *
* @return bool true on success or false on failure. */ function ssh2_scp_send($session, $local_file, $remote_file, $create_mode = null) {} /** * (PECL ssh2 >= 0.9.0)*
* @param int $streamid* An SSH2 channel stream. *
* @return resource the requested stream resource. */ function ssh2_fetch_stream($channel, $streamid) {} /** * @param array &$var1 */ function ssh2_poll(&$var1) {} /** * (PECL ssh2 >= 0.9.0)* An SSH connection link identifier, obtained from a call to * ssh2_connect. *
* @return resource|false This method returns an SSH2 SFTP resource for use with * all other ssh2_sftp_*() methods and the * ssh2.sftp:// fopen wrapper. */ function ssh2_sftp($session) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $from* The current file that is being renamed. *
* @param string $to* The new file name that replaces from. *
* @return bool true on success or false on failure. */ function ssh2_sftp_rename($sftp, $from, $to) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $filename*
* @return bool true on success or false on failure. */ function ssh2_sftp_unlink($sftp, $filename) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $dirname* Path of the new directory. *
* @param int $mode [optional]* Permissions on the new directory. *
* @param bool $recursive [optional]* If recursive is true any parent directories * required for dirname will be automatically created as well. *
* @return bool true on success or false on failure. */ function ssh2_sftp_mkdir($sftp, $dirname, $mode = null, $recursive = null) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $dirname*
* @return bool true on success or false on failure. */ function ssh2_sftp_rmdir($sftp, $dirname) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $path*
* @return array|false See the documentation for stat for details on the * values which may be returned. */ function ssh2_sftp_stat($sftp, $path) {} /** * (PECL ssh2 >= 0.9.0)*
* @param string $path* Path to the remote symbolic link. *
* @return array See the documentation for stat for details on the * values which may be returned. */ function ssh2_sftp_lstat($sftp, $path) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $target* Target of the symbolic link. *
* @param string $link*
* @return bool true on success or false on failure. */ function ssh2_sftp_symlink($sftp, $target, $link) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $link* Path of the symbolic link. *
* @return string the target of the symbolic link. */ function ssh2_sftp_readlink($sftp, $link) {} /** * (PECL ssh2 >= 0.9.0)* An SSH2 SFTP resource opened by ssh2_sftp. *
* @param string $filename*
* @return string the real path as a string. */ function ssh2_sftp_realpath($sftp, $filename) {} /** * (PECL ssh2 >= 0.10)*
* @return resource|false an SSH2 Publickey Subsystem resource for use * with all other ssh2_publickey_*() methods or false on failure. */ function ssh2_publickey_init($session) {} /** * (PECL ssh2 >= 0.10)* Publickey Subsystem resource created by ssh2_publickey_init. *
* @param string $algoname* Publickey algorithm (e.g.): ssh-dss, ssh-rsa *
* @param string $blob* Publickey blob as raw binary data *
* @param null|bool $overwrite [optional]* If the specified key already exists, should it be overwritten? *
* @param null|array $attributes [optional]* Associative array of attributes to assign to this public key. * Refer to ietf-secsh-publickey-subsystem for a list of supported attributes. * To mark an attribute as mandatory, precede its name with an asterisk. * If the server is unable to support an attribute marked mandatory, * it will abort the add process. *
* @return bool true on success or false on failure. */ function ssh2_publickey_add($pkey, $algoname, $blob, $overwrite = null, ?array $attributes = null) {} /** * (PECL ssh2 >= 0.10)* Publickey Subsystem Resource *
* @param string $algoname* Publickey algorithm (e.g.): ssh-dss, ssh-rsa *
* @param string $blob* Publickey blob as raw binary data *
* @return bool true on success or false on failure. */ function ssh2_publickey_remove($pkey, $algoname, $blob) {} /** * (PECL ssh2 >= 0.10)* Publickey Subsystem resource *
* @return array a numerically indexed array of keys, * each of which is an associative array containing: * name, blob, and attrs elements. * **
Array Key | *Meaning | *
name | *Name of algorithm used by this publickey, for example: * ssh-dss or ssh-rsa. | *
blob | *Publickey blob as raw binary data. | *
attrs | *Attributes assigned to this publickey. The most common * attribute, and the only one supported by publickey version 1 * servers, is comment, which may be any freeform * string. | *
An SSH2 SFTP resource opened by ssh2_sftp().
* @param string $filenamePath to the file.
* @param int $modePermissions on the file. See the chmod() for more details on this parameter.
* @return boolReturns TRUE on success or FALSE on failure.
*/ function ssh2_sftp_chmod($sftp, $filename, $mode) {} /** * (PECL ssh2 >= 0.12)* Authenticate over SSH using the ssh agent *
** Note: The ssh2_auth_agent() function will only be available when the ssh2 extension is compiled with libssh >= 1.2.3. *
* @param resource $sessionAn SSH connection link identifier, obtained from a call to ssh2_connect().
* @param string $usernameRemote user name.
* @return boolReturns TRUE on success or FALSE on failure.
*/ function ssh2_auth_agent($session, $username) {} /** * Flag to ssh2_fingerprint requesting hostkey * fingerprint as an MD5 hash. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_FINGERPRINT_MD5', 0); /** * Flag to ssh2_fingerprint requesting hostkey * fingerprint as an SHA1 hash. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_FINGERPRINT_SHA1', 1); /** * Flag to ssh2_fingerprint requesting hostkey * fingerprint as a string of hexits. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_FINGERPRINT_HEX', 0); /** * Flag to ssh2_fingerprint requesting hostkey * fingerprint as a raw string of 8-bit characters. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_FINGERPRINT_RAW', 2); /** * Flag to ssh2_shell specifying that * width and height * are provided as character sizes. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_TERM_UNIT_CHARS', 0); /** * Flag to ssh2_shell specifying that * width and height * are provided in pixel units. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_TERM_UNIT_PIXELS', 1); /** * Default terminal type (e.g. vt102, ansi, xterm, vanilla) requested * by ssh2_shell. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_DEFAULT_TERMINAL', "vanilla"); /** * Default terminal width requested by ssh2_shell. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_DEFAULT_TERM_WIDTH', 80); /** * Default terminal height requested by ssh2_shell. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_DEFAULT_TERM_HEIGHT', 25); /** * Default terminal units requested by ssh2_shell. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_DEFAULT_TERM_UNIT', 0); /** * Flag to ssh2_fetch_stream requesting STDIO subchannel. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_STREAM_STDIO', 0); /** * Flag to ssh2_fetch_stream requesting STDERR subchannel. * @link https://php.net/manual/en/ssh2.constants.php */ define('SSH2_STREAM_STDERR', 1); define('SSH2_POLLIN', 1); define('SSH2_POLLEXT', 2); define('SSH2_POLLOUT', 4); define('SSH2_POLLERR', 8); define('SSH2_POLLHUP', 16); define('SSH2_POLLNVAL', 32); define('SSH2_POLL_SESSION_CLOSED', 16); define('SSH2_POLL_CHANNEL_CLOSED', 128); define('SSH2_POLL_LISTENER_CLOSED', 128);