Document ssh2 fopen wrappers

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@175569 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sara Golemon 2004-12-25 01:33:49 +00:00
parent 1dfa35bc49
commit 14a75c1817

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.46 $ -->
<!-- $Revision: 1.47 $ -->
<appendix id="wrappers">
<title>List of Supported Protocols/Wrappers</title>
<para>
@ -760,6 +760,237 @@ file_put_contents("php://filter/write=string.rot13/resource=example.txt","Hello
</table>
</para>
</section>
<section id="wrappers.ssh2">
<title>Secure Shell 2</title>
<simpara>
<filename>ssh2.shell://</filename>
<filename>ssh2.exec://</filename>
<filename>ssh2.tunnel://</filename>
<filename>ssh2.sftp://</filename>
<filename>ssh2.scp://</filename>
PHP 4.3.0 and up (PECL)
</simpara>
<itemizedlist>
<listitem><simpara><filename>ss2.shell://user:pass@example.com:22/xterm</filename></simpara></listitem>
<listitem><simpara><filename>ss2.exec://user:pass@example.com:22/usr/local/bin/somecmd</filename></simpara></listitem>
<listitem><simpara><filename>ss2.tunnel://user:pass@example.com:22/192.168.0.1:14</filename></simpara></listitem>
<listitem><simpara><filename>ss2.sftp://user:pass@example.com:22/path/to/filename</filename></simpara></listitem>
</itemizedlist>
<note>
<title>This wrapper is not enabled by default</title>
<simpara>
In order to use the <filename>ssh2.*://</filename> wrappers you must install
the <ulink url="&url.pecl.package;ssh2">SSH2</ulink> extension
available from <ulink url="&url.pecl;">PECL</ulink>.
</simpara>
</note>
<simpara>
In addition to accepting traditional URI login details, the ssh2 wrappers
will also reuse open connections by passing the connection resource in the
host portion of the URL.
</simpara>
<example>
<title>Opening a stream from an active connection</title>
<programlisting role="php">
<![CDATA[
<?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');
?>
]]>
</programlisting>
</example>
<para>
<table>
<title>Wrapper Summary</title>
<tgroup cols="6">
<thead>
<row>
<entry>Attribute</entry>
<entry>ssh2.shell</entry>
<entry>ssh2.exec</entry>
<entry>ssh2.tunnel</entry>
<entry>ssh2.sftp</entry>
<entry>ssh2.scp</entry>
</row>
</thead>
<tbody>
<row>
<entry>Restricted by <link linkend="ini.allow-url-fopen">allow_url_fopen</link>.</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry>Allows Reading</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry>Allows Writing</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Allows Appending</entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes (When supported by server)</entry>
<entry>No</entry>
</row>
<row>
<entry>Allows Simultaneous Reading and Writing</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Supports <function>stat</function></entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Supports <function>unlink</function></entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Supports <function>rename</function></entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Supports <function>mkdir</function></entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>Supports <function>rmdir</function></entry>
<entry>No</entry>
<entry>No</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>Context options</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Usage</entry>
<entry>Default</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>session</literal></entry>
<entry>Preconnected ssh2 resource to be reused</entry>
<entry/>
</row>
<row>
<entry><literal>sftp</literal></entry>
<entry>Preallocated sftp resource to be reused</entry>
<entry/>
</row>
<row>
<entry><literal>methods</literal></entry>
<entry>Key exchange, hostkey, cipher, compression, and MAC methods to use</entry>
<entry/>
</row>
<row>
<entry><literal>callbacks</literal></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><literal>username</literal></entry>
<entry>Username to connect as</entry>
<entry></entry>
</row>
<row>
<entry><literal>password</literal></entry>
<entry>Password to use with password authentication</entry>
<entry></entry>
</row>
<row>
<entry><literal>pubkey_file</literal></entry>
<entry>Name of public key file to use for authentication</entry>
<entry></entry>
</row>
<row>
<entry><literal>privkey_file</literal></entry>
<entry>Name of private key file to use for authentication</entry>
<entry></entry>
</row>
<row>
<entry><literal>env</literal></entry>
<entry>Associate array of environment variables to set</entry>
<entry></entry>
</row>
<row>
<entry><literal>term</literal></entry>
<entry>Terminal emulation type to request when allocating a pty</entry>
<entry></entry>
</row>
<row>
<entry><literal>term_width</literal></entry>
<entry>Width of terminal requested when allocating a pty</entry>
<entry></entry>
</row>
<row>
<entry><literal>term_height</literal></entry>
<entry>Height of terminal requested when allocating a pty</entry>
<entry></entry>
</row>
<row>
<entry><literal>term_units</literal></entry>
<entry>Units to use with term_width and term_height</entry>
<entry><constant>SSH2_TERM_UNIT_CHARS</constant></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</section>
<section id="wrappers.audio">
<title>Audio Streams</title>
<simpara><filename>ogg://</filename> PHP 4.3.0 and up (PECL) </simpara>