<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Secure Shell2 Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="函数参考" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="PDO->sqliteCreateFunction()" HREF="function.pdo-sqlitecreatefunction.html"><LINK REL="NEXT" TITLE="ssh2_auth_hostbased_file" HREF="function.ssh2-auth-hostbased-file.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pdo-sqlitecreatefunction.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ssh2-auth-hostbased-file.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.ssh2" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CLVIII. Secure Shell2 Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN218552" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="ssh2.intro" >简介</A ></H1 ><P > Bindings to the <A HREF="http://sourceforge.net/projects/libssh2/" TARGET="_top" >libssh2</A > library which provide access to resources (shell, remote exec, tunneling, file transfer) on a remote machine using a secure cryptographic transport. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="ssh2.installation" >安装</A ></H1 ><P > <SPAN CLASS="emphasis" ><I CLASS="emphasis" >Windows</I ></SPAN > binaries may be found at <A HREF="http://snaps.php.net/" TARGET="_top" >http://snaps.php.net/</A >. To install, download php_ssh2.dll to the folder specified by your php.ini file's <TT CLASS="literal" >extension_dir</TT > directive. Enable it by adding <TT CLASS="literal" >extension=php_ssh2.dll</TT > to your php.ini and restarting your web server. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >extension_dir=c:/php5/exts/ extension=php_ssh2.dll</PRE ></TD ></TR ></TABLE ><P > <SPAN CLASS="emphasis" ><I CLASS="emphasis" >Linux, BSD, and other *nix variants</I ></SPAN > can be compiled using the following steps: </P ><P ></P ><UL ><LI ><P > Download and install <A HREF="http://www.openssl.org/" TARGET="_top" >OpenSSL</A >. If you install OpenSSL via your distribution's packaging system be sure to install the development libraries as well. This will typically be a package named <TT CLASS="literal" >openssl-dev</TT >, <TT CLASS="literal" >openssl_devel</TT >, or some variation thereof. </P ></LI ><LI ><P > Download and install <A HREF="http://sourceforge.net/projects/libssh2/" TARGET="_top" >libssh2</A >. Typically this means executing the following command from the libssh2 source tree. <TT CLASS="literal" >./configure && make all install</TT >. </P ></LI ><LI ><P > Run the pear installer for PECL/ssh2: <TT CLASS="literal" >pear install ssh2</TT > </P ></LI ><LI ><P > Copy <TT CLASS="literal" >ssh2.so</TT > from the directory indicated by the build process to the location specified in your php.ini file under <TT CLASS="literal" >extension_dir</TT >. </P ></LI ><LI ><P > Add <TT CLASS="literal" >extension=ssh2.so</TT > to your php.ini </P ></LI ><LI ><P > Restart your web server to reload your php.ini settings. </P ></LI ></UL ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Development Versions: </B > There are currently no <TT CLASS="literal" >stable</TT > versions of PECL/ssh2, to force installation of the <TT CLASS="literal" >beta</TT > version of PECL/ssh2 execute: <TT CLASS="literal" >pear install ssh2-</TT ><SPAN CLASS="emphasis" ><I CLASS="emphasis" >beta</I ></SPAN > </P ></BLOCKQUOTE ></DIV ><DIV CLASS="tip" ><BLOCKQUOTE CLASS="tip" ><P ><B >Compiling PECL/ssh2 without using the PEAR command: </B > Rather than using <TT CLASS="literal" >pear install ssh2</TT > to automatically download and install PECL/ssh2, you may download the tarball from <A HREF="http://pecl.php.net/package/ssh2" TARGET="_top" >PECL</A >. From the root of the unpacked tarball, run: <TT CLASS="literal" >phpize && ./configure --with-ssh2 && make</TT > to generate <TT CLASS="literal" >ssh2.so</TT >. Once built, continue the installation from step 4 above. </P ></BLOCKQUOTE ></DIV ><P > 安装此 PECL 扩展库的信息可在手册中标题为 <A HREF="install.pecl.html" >PECL 扩展库安装</A >的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: <A HREF="http://pecl.php.net/package/ssh2" TARGET="_top" >http://pecl.php.net/package/ssh2</A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > You will need version 0.4 or greater of the libssh2 library (possibly higher, see release notes). </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="ssh2.constants" >预定义常量</A ></H1 ><P >以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。</P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >SSH2_FINGERPRINT_MD5</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fingerprint.html" ><B CLASS="function" >ssh2_fingerprint()</B ></A > requesting hostkey fingerprint as an MD5 hash. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_FINGERPRINT_SHA1</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fingerprint.html" ><B CLASS="function" >ssh2_fingerprint()</B ></A > requesting hostkey fingerprint as an SHA1 hash. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_FINGERPRINT_HEX</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fingerprint.html" ><B CLASS="function" >ssh2_fingerprint()</B ></A > requesting hostkey fingerprint as a string of hexits. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_FINGERPRINT_RAW</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fingerprint.html" ><B CLASS="function" >ssh2_fingerprint()</B ></A > requesting hostkey fingerprint as a raw string of 8-bit characters. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_TERM_UNIT_CHARS</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A > specifying that <CODE CLASS="parameter" >width</CODE > and <CODE CLASS="parameter" >height</CODE > are provided as character sizes. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_TERM_UNIT_PIXELS</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A > specifying that <CODE CLASS="parameter" >width</CODE > and <CODE CLASS="parameter" >height</CODE > are provided in pixel units. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_DEFAULT_TERM_WIDTH</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Default terminal width requested by <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A >. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_DEFAULT_TERM_HEIGHT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Default terminal height requested by <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A >. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_DEFAULT_TERM_UNIT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Default terminal units requested by <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A >. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_STREAM_STDIO</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fetch-stream.html" ><B CLASS="function" >ssh2_fetch_stream()</B ></A > requesting STDIO subchannel. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_STREAM_STDERR</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > Flag to <A HREF="function.ssh2-fetch-stream.html" ><B CLASS="function" >ssh2_fetch_stream()</B ></A > requesting STDERR subchannel. </P ></DD ><DT ><TT CLASS="constant" ><B >SSH2_DEFAULT_TERMINAL</B ></TT > (<A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A >)</DT ><DD ><P > Default terminal type (e.g. vt102, ansi, xterm, vanilla) requested by <A HREF="function.ssh2-shell.html" ><B CLASS="function" >ssh2_shell()</B ></A >. </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >目录</B ></DT ><DT ><A HREF="function.ssh2-auth-hostbased-file.html" >ssh2_auth_hostbased_file</A > -- Authenticate using a public hostkey </DT ><DT ><A HREF="function.ssh2-auth-none.html" >ssh2_auth_none</A > -- Authenticate as "none" </DT ><DT ><A HREF="function.ssh2-auth-password.html" >ssh2_auth_password</A > -- Authenticate over SSH using a plain password </DT ><DT ><A HREF="function.ssh2-auth-pubkey-file.html" >ssh2_auth_pubkey_file</A > -- Authenticate using a public key </DT ><DT ><A HREF="function.ssh2-connect.html" >ssh2_connect</A > -- Connect to an SSH server </DT ><DT ><A HREF="function.ssh2-exec.html" >ssh2_exec</A > -- Execute a command on a remote server </DT ><DT ><A HREF="function.ssh2-fetch-stream.html" >ssh2_fetch_stream</A > -- Fetch an extended data stream </DT ><DT ><A HREF="function.ssh2-fingerprint.html" >ssh2_fingerprint</A > -- Retreive fingerprint of remote server </DT ><DT ><A HREF="function.ssh2-methods-negotiated.html" >ssh2_methods_negotiated</A > -- Return list of negotiated methods </DT ><DT ><A HREF="function.ssh2-publickey-add.html" >ssh2_publickey_add</A > -- Add an authorized publickey </DT ><DT ><A HREF="function.ssh2-publickey-init.html" >ssh2_publickey_init</A > -- Initialize Publickey subsystem </DT ><DT ><A HREF="function.ssh2-publickey-list.html" >ssh2_publickey_list</A > -- List currently authorized publickeys </DT ><DT ><A HREF="function.ssh2-publickey-remove.html" >ssh2_publickey_remove</A > -- Remove an authorized publickey </DT ><DT ><A HREF="function.ssh2-scp-recv.html" >ssh2_scp_recv</A > -- Request a file via SCP </DT ><DT ><A HREF="function.ssh2-scp-send.html" >ssh2_scp_send</A > -- Send a file via SCP </DT ><DT ><A HREF="function.ssh2-sftp-lstat.html" >ssh2_sftp_lstat</A > -- Stat a symbolic link </DT ><DT ><A HREF="function.ssh2-sftp-mkdir.html" >ssh2_sftp_mkdir</A > -- Create a directory </DT ><DT ><A HREF="function.ssh2-sftp-readlink.html" >ssh2_sftp_readlink</A > -- Return the target of a symbolic link </DT ><DT ><A HREF="function.ssh2-sftp-realpath.html" >ssh2_sftp_realpath</A > -- Resolve the realpath of a provided path string </DT ><DT ><A HREF="function.ssh2-sftp-rename.html" >ssh2_sftp_rename</A > -- Rename a remote file </DT ><DT ><A HREF="function.ssh2-sftp-rmdir.html" >ssh2_sftp_rmdir</A > -- Remove a directory </DT ><DT ><A HREF="function.ssh2-sftp-stat.html" >ssh2_sftp_stat</A > -- Stat a file on a remote filesystem </DT ><DT ><A HREF="function.ssh2-sftp-symlink.html" >ssh2_sftp_symlink</A > -- Create a symlink </DT ><DT ><A HREF="function.ssh2-sftp-unlink.html" >ssh2_sftp_unlink</A > -- Delete a file </DT ><DT ><A HREF="function.ssh2-sftp.html" >ssh2_sftp</A > -- Initialize SFTP subsystem </DT ><DT ><A HREF="function.ssh2-shell.html" >ssh2_shell</A > -- Request an interactive shell </DT ><DT ><A HREF="function.ssh2-tunnel.html" >ssh2_tunnel</A > -- Open a tunnel through a remote server </DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pdo-sqlitecreatefunction.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ssh2-auth-hostbased-file.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >PDO->sqliteCreateFunction()</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ssh2_auth_hostbased_file</TD ></TR ></TABLE ></DIV ></BODY ></HTML >