ssh2_shell
(PECL ssh2 >= 0.9.0)
ssh2_shell — 対話式のシェルを要求する
説明
resource ssh2_shell
( resource
$session
[, string $term_type = "vanilla"
[, array $env
[, int $width = 80
[, int $height = 25
[, int $width_height_type = SSH2_TERM_UNIT_CHARS
]]]]] )リモートエンド上のシェルをオープンし、そのためのストリームを割り当てます。
パラメータ
-
session -
ssh2_connect() のコールによって取得した SSH 接続リンク ID。
-
term_type -
term_typeは対象システムの /etc/termcap に記載されたエントリの一つに相当します。 -
env -
envには、 対象の環境に設定する名前/値の組の連想配列を渡すことができます。 -
width -
仮想端末の幅。
-
height -
仮想端末の高さ。
-
width_height_type -
width_height_typeはSSH2_TERM_UNIT_CHARSあるいはSSH2_TERM_UNIT_PIXELSのいずれかです。
返り値
例
例1 コマンドの実行
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_shell($connection, 'vt102', null, 80, 24, SSH2_TERM_UNIT_CHARS);
?>
参考
- ssh2_exec() - リモートサーバー上でコマンドを実行する
- ssh2_tunnel() - リモートサーバーを経由するトンネルをオープンする
- ssh2_fetch_stream() - 拡張データストリームを取得する