* 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. *

*

* * methods may be an associative array * with any or all of the following parameters. * * * * * * * * * * * * * * * * * * * * * * * *
IndexMeaningSupported 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. *

*

* * client_to_server and * server_to_client may be an associative array * with any or all of the following parameters. * * * * * * * * * * * * * * * * * * * * *
IndexMeaningSupported Values*
cryptList 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** *
compList of compression methods to advertise, comma separated * in order of preference. * zlib and * none *
macList 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. * * Callbacks parameters * * * * * * * * * * * * * * * * * * * * * * * * * *
IndexMeaningPrototype
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)
*

* @return resource|false a resource on success, or false on error. */ function ssh2_connect($host, $port = 22, ?array $methods = null, ?array $callbacks = null) {} /** * (PECL ssh2 >= 1.0)
* Close a connection to a remote SSH server * @link https://php.net/manual/en/function.ssh2-disconnect.php * @param resource $session

* An SSH connection link identifier, obtained from a call to * ssh2_connect. *

* @return bool */ function ssh2_disconnect($session) {} /** * (PECL ssh2 >= 0.9.0)
* Return list of negotiated methods * @link https://php.net/manual/en/function.ssh2-methods-negotiated.php * @param resource $session

* An SSH connection link identifier, obtained from a call to * ssh2_connect. *

* @return array */ function ssh2_methods_negotiated($session) {} /** * (PECL ssh2 >= 0.9.0)
* Retrieve fingerprint of remote server * @link https://php.net/manual/en/function.ssh2-fingerprint.php * @param resource $session

* 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)
* Authenticate as "none" * @link https://php.net/manual/en/function.ssh2-auth-none.php * @param resource $session

* 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)
* Authenticate over SSH using a plain password * @link https://php.net/manual/en/function.ssh2-auth-password.php * @param resource $session

* 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)
* Authenticate using a public key * @link https://php.net/manual/en/function.ssh2-auth-pubkey-file.php * @param resource $session

* 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)
* Authenticate using a public hostkey * @link https://php.net/manual/en/function.ssh2-auth-hostbased-file.php * @param resource $session

* 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)
* Request an interactive shell * @link https://php.net/manual/en/function.ssh2-shell.php * @param resource $session

* 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)
* Execute a command on a remote server * @link https://php.net/manual/en/function.ssh2-exec.php * @param resource $session

* 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)
* Open a tunnel through a remote server * @link https://php.net/manual/en/function.ssh2-tunnel.php * @param resource $session

* 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)
* Request a file via SCP * @link https://php.net/manual/en/function.ssh2-scp-recv.php * @param resource $session

* 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)
* Send a file via SCP * @link https://php.net/manual/en/function.ssh2-scp-send.php * @param resource $session

* 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)
* Fetch an extended data stream * @link https://php.net/manual/en/function.ssh2-fetch-stream.php * @param resource $channel

*

* @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)
* Initialize SFTP subsystem * @link https://php.net/manual/en/function.ssh2-sftp.php * @param resource $session

* 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)
* Rename a remote file * @link https://php.net/manual/en/function.ssh2-sftp-rename.php * @param resource $sftp

* 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)
* Delete a file * @link https://php.net/manual/en/function.ssh2-sftp-unlink.php * @param resource $sftp

* 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)
* Create a directory * @link https://php.net/manual/en/function.ssh2-sftp-mkdir.php * @param resource $sftp

* 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)
* Remove a directory * @link https://php.net/manual/en/function.ssh2-sftp-rmdir.php * @param resource $sftp

* 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)
* Stat a file on a remote filesystem * @link https://php.net/manual/en/function.ssh2-sftp-stat.php * @param resource $sftp

* 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)
* Stat a symbolic link * @link https://php.net/manual/en/function.ssh2-sftp-lstat.php * @param resource $sftp

*

* @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)
* Create a symlink * @link https://php.net/manual/en/function.ssh2-sftp-symlink.php * @param resource $sftp

* 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)
* Return the target of a symbolic link * @link https://php.net/manual/en/function.ssh2-sftp-readlink.php * @param resource $sftp

* 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)
* Resolve the realpath of a provided path string * @link https://php.net/manual/en/function.ssh2-sftp-realpath.php * @param resource $sftp

* 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)
* Initialize Publickey subsystem * @link https://php.net/manual/en/function.ssh2-publickey-init.php * @param resource $session

*

* @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)
* Add an authorized publickey * @link https://php.net/manual/en/function.ssh2-publickey-add.php * @param resource $pkey

* 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)
* Remove an authorized publickey * @link https://php.net/manual/en/function.ssh2-publickey-remove.php * @param resource $pkey

* 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)
* List currently authorized publickeys * @link https://php.net/manual/en/function.ssh2-publickey-list.php * @param resource $pkey

* Publickey Subsystem resource *

* @return array a numerically indexed array of keys, * each of which is an associative array containing: * name, blob, and attrs elements. *

*

* * Publickey elements * * * * * * * * * * * * * * * * *
Array KeyMeaning
nameName of algorithm used by this publickey, for example: * ssh-dss or ssh-rsa.
blobPublickey blob as raw binary data.
attrsAttributes 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.
*/ function ssh2_publickey_list($pkey) {} /** * (PECL ssh2 >= 0.12)
* ssh2_sftp_chmod — Changes file mode * @link https://php.net/manual/en/function.ssh2-sftp-chmod.php * @param resource $sftp

An SSH2 SFTP resource opened by ssh2_sftp().

* @param string $filename

Path to the file.

* @param int $mode

Permissions on the file. See the chmod() for more details on this parameter.

* @return bool

Returns TRUE on success or FALSE on failure.

*/ function ssh2_sftp_chmod($sftp, $filename, $mode) {} /** * (PECL ssh2 >= 0.12)
* ssh2_auth_agent — Authenticate over SSH using the ssh agent * @link https://php.net/manual/en/function.ssh2-auth-agent.php *

* 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 $session

An SSH connection link identifier, obtained from a call to ssh2_connect().

* @param string $username

Remote user name.

* @return bool

Returns 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);