downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

rar://> <phar://
[edit] Last updated: Fri, 25 May 2012

view this page in

ssh2://

ssh2://Secure Shell 2

説明

ssh2.shell:// ssh2.exec:// ssh2.tunnel:// ssh2.sftp:// ssh2.scp:// PHP 4.3.0 以降(PECL)

注意: このラッパーはデフォルトでは有効になっていません
ssh2.*:// ラッパーを使用するには、 » PECL から » SSH2 拡張モジュールを インストールする必要があります。

ssh2 ラッパーでは、URL のホスト部分に接続リソースを渡すことで既にオープン している接続を再利用することが可能です。

オプション

  • ssh2.shell://user:pass@example.com:22/xterm
  • ssh2.exec://user:pass@example.com:22/usr/local/bin/somecmd
  • ssh2.tunnel://user:pass@example.com:22/192.168.0.1:14
  • ssh2.sftp://user:pass@example.com:22/path/to/filename

オプション

ラッパーの概要
属性 ssh2.shell ssh2.exec ssh2.tunnel ssh2.sftp ssh2.scp
allow_url_fopen で制約される Yes Yes Yes Yes Yes
読み込み許可 Yes Yes Yes Yes Yes
書き込み許可 Yes Yes Yes Yes No
追加許可 No No No Yes(サーバーがサポートしている場合) No
同時読み書き許可 Yes Yes Yes Yes No
stat() のサポート No No No Yes No
unlink() のサポート No No No Yes No
rename() のサポート No No No Yes No
mkdir() のサポート No No No Yes No
rmdir() のサポート No No No Yes No

コンテキストオプション
名前 使用法 デフォルト
session 再利用する接続済みの ssh2 リソース  
sftp 再利用する割り当て済みの sftp リソース  
methods Key exchange, hostkey, cipher, compression, および MAC methods  
callbacks    
username 接続するユーザー名  
password パスワード認証に使用するパスワード  
pubkey_file 認証に使用する公開鍵ファイル  
privkey_file 認証に使用する秘密鍵ファイル  
env 設定する環境変数の連想配列  
term pty を割り当てる際の端末エミュレート方式  
term_width pty を割り当てる際の端末の幅  
term_height pty を割り当てる際の端末の高さ  
term_units term_width および term_height の単位 SSH2_TERM_UNIT_CHARS

例1 アクティブな接続からストリームをオープンする

<?php
$session 
ssh2_connect('example.com'22);
ssh2_auth_pubkey_file($session'username''/home/username/.ssh/id_rsa.pub',
                                            
'/home/username/.ssh/id_rsa''secret');
$stream fopen("ssh2.tunnel://$session/remote.example.com:1234"'r');
?>


add a note add a note User Contributed Notes ssh2://
stm555 at hotmail dot com 12-Sep-2011 12:41
Note that using the resource inline in the uri does work, (ie, ssh2.sftp://$session/path/to/file) but will (at least in PHP 5.2.5) throw a "supplied resource is not a valid SSH2 SFTP resource in .." warning on things like file_get_contents.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites