PHP.mk документација

SSH2 Функции

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

ref.ssh2.php PHP.net прокси Преводот е вчитан
Оригинал на PHP.net
Патека ref.ssh2.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + преведен приказ Кодовите, табелите и белешките остануваат читливи во истиот тек.
SSH2 Функции

Референца за `ref.ssh2.php` со подобрена типографија и навигација.

ref.ssh2.php

SSH2 Функции

Содржина

  • ssh2_auth_agent — Автентицирај преку SSH користејќи го ssh агентот
  • ssh2_auth_hostbased_file — Автентицирај користејќи ја јавната клубска клуча
  • ssh2_auth_none — Автентицирај како "none"
  • ssh2_auth_password — Автентицирај преку SSH користејќи обична лозинка
  • ssh2_auth_pubkey — Автентицирај користејќи јавна клуча во променлива
  • ssh2_auth_pubkey_file — Автентицирај користејќи јавна клуча прочитана од датотека
  • ssh2_connect — Поврзи се со SSH сервер
  • ssh2_disconnect — Затвори врска со оддалечен SSH сервер
  • ssh2_exec — Изврши команда на оддалечен сервер
  • ssh2_fetch_stream — Преземи проширен тек на податоци
  • ssh2_fingerprint — Преземи отпечаток од оддалечен сервер
  • ssh2_forward_accept — Прифати врска создадена од слушател
  • ssh2_forward_listen — Поврзи порта на оддалечениот сервер и слушај за врски
  • ssh2_methods_negotiated — Врати список на договорени методи
  • ssh2_poll — Провери ги каналите/слушателите/токовите за настани
  • ssh2_publickey_add — Додај овластена јавна клуча
  • ssh2_publickey_init — Иницијализирај Publickey подсистем
  • ssh2_publickey_list — Иницијализирај јавно-клучна потсистема
  • ssh2_publickey_remove — Листај моментално овластени јавно-клучни потписи
  • ssh2_scp_recv — Отстрани овластен јавно-клуч потпис
  • ssh2_scp_send — Барај датотека преку SCP
  • ssh2_send_eof — Испрати датотека преку SCP
  • ssh2_sftp — Испрати EOF до стрим
  • ssh2_sftp_chmod — Иницијализирај SFTP потсистема
  • ssh2_sftp_lstat — Промени режим на датотека
  • ssh2_sftp_mkdir — Креирај директориум
  • ssh2_sftp_readlink — Статус на симболичка врска
  • ssh2_sftp_realpath — Врати ја целта на симболичка врска
  • ssh2_sftp_rename — Реши го реалниот пат на даден стринг со патека
  • ssh2_sftp_rmdir — Преименувај далечинска датотека
  • ssh2_sftp_stat — Отстрани директориум
  • ssh2_sftp_symlink — Статус на датотека на далечинскиот фајл систем
  • ssh2_sftp_unlink — Избриши датотека
  • ssh2_shell — Креирај симболичка врска
  • ssh2_tunnel — Барај интерактивна школка

Белешки од корисници 8 белешки

— Иницијализирај јавно-клучна потсистема
пред 18 години
you will have an issue transferring any file using ssh2_scp_send unless you send a dummy file after your real file, or preferably issue an 

ssh2_exec ($connection, 'exit'); 

I was transferring hundreds of thousands of files in my prototype across multiple servers, and noticed that each file had a mismatched md5 hash and bytelength.

after a bit of research i learnt that this was a bug, and added the code above as suggested at pecl.php.net in the bugs section.

hopefully this helps someone who is getting partial file transfer that could ruin your whole app.
dan на novapulsar dot com
19 години пред
Installing on HPUX 11.11 cookbook

Just follow the install instructions on the man page and solved the problems as they appear

- when making libssh2
Problem related with /lib/pa20_64 and 64 bits library in 32 bits link
Edited the configure file  and changed
SHLIB_LDFLAGS="-b +vnocompatwarnings -L/lib/pa20_64"
to
SHLIB_LDFLAGS="-b +vnocompatwarnings -L/lib"

-when executing phpize
Problems with aclocal, autom4ke and m4
Installed automake, autoconf and m4

-when ./configuring the ssh2 
Configure: error: libssh2 version >= 0.4 not found
Edited the configure.m4 and removed the -ldl switch from line (as posted before)
39      -L$SSH2_DIR/lib -lm -ldl
runned phpize again and ./configure --with-ssh2
shred
пред 8 години
Getting strange "Unable to open ssh2.sftp://Resource id #3/example.txt" errors? This is a bug in PHP > 5.6.27. Use intval() as a workaround to make ssh2 work again:

$sftp = ssh2_sftp($connection);
fopen("ssh2.sftp://" . intval($sftp) . "/example.txt", 'r');

https://bugs.php.net/bug.php?id=73597
astribuncio на gmail dot com
19 години пред
I was building out the ssh2 extension (0.10) under OpenBSD 3.9 on sparc64 and I got this error when running configure:

checking for libssh2_banner_set in -lssh2... no
configure: error: libssh2 version >= 0.4 not found

I did some poking around in the configure file and traced the problem down.  The reason for the failure is that configure is trying to compile a test program with -ldl.  libdl is not installed on OpenBSD 3.9. The OpenBSD folks purged libdl years ago and I could not find a package that contains it. 

(The error message above is misleading because the problem is not with libssh2.)

I looked at the ssh2 extension code and could not see a reason for using libdl, so I removed the -ldl from the config.m4 file.  Re-ran phpize and configure. No errors.  Did make and installed ssh2.so.  Works fine.
chris dot britton на cingular dot com
19 години пред
To list directory contents:

<?php
$connection = ssh2_connect(\"hostname\", 22);
ssh2_auth_password($connection,\"username\", \"password\");  // or use any of the ssh2_auth_* methods
$sftp = ssh2_sftp($connection);

$dh = opendir(\"ssh2.sftp://$sftp/path/to/dir/\");

while (($file = readdir($dh)) !== false) {
  echo \"$file is in hostname:/path/to/dir\\n\";
}

closedir($dh);
?>

(thanks to Sara for assisting)
Mike <esnik8202 на sneakemail dot com>
20 години пред
Trying to compile this ssh PECL extension for Mac OS X (10.4.2) 
with entropy.ch's php5 distribution? Read on: PART 1:
1) Download libssh (I used version 0.11)
http://sourceforge.net/project/showfiles.php?group_id=125852
2) Unzip the directory and cd to the upacked directory in the terminal.
3) run: ./configure; make all install;
libssh should compile and place the output file in src/*.o
4) copy all headers from the include folder within the libssh2 directory to
/usr/local/include/
5) copy all compiled files (*.o) from the src folder within the libssh2 
directory to /usr/local/lib/
6) Download ssh2 
(I used version 0.9 with additional changes from cvs - explained below)
http://pecl.php.net/package/ssh2
7) unzip the downloaded archive.
8) version 0.9 has a conflict with an existing symbol used in some of the ZEND headers... 
a change is available in cvs which renames the symbol in ssh2 to avoid the conflict
http://cvs.php.net/diff.php/pecl/ssh2/ssh2.c?r1=1.9&r2=1.10&ty=h
down load at least the 1.10 version of ssh2.c
if you decide to download a newer version, download any of the corresponding related files, 
such as the php_ssh2.h header file.
9) replace the old version of ssh2.c with the new version of ssh2.c 
(and any other files you downloaded).
10) From the terminal: 
cd to the source directory (for me ssh2-0.9/ssh2-0.9/).

(Continued in a PART 2 comment)
dotwho на NSPM dot mac dot com
пред 18 години
Some installations of PHP 5 may have a problem starting the SSH2 extension as a Windows' service. It just started happening to me today, spontaneously. I have PHP 5.2.2 (and have tried 5.2.3), on Apache 2.0.59 .

It turns out that it's an Apache problem. Even though I was given an error message when starting it, it still worked perfectly from the CLI. So, I commented it out in the
INI file again, and am just loading it using extension_loaded('ssh2') and dl('php_ssh2.dll') from within the script.
Mike <esnik8202 на sneakemail dot com>
20 години пред
Trying to compile this ssh PECL extension for Mac OS X (10.4.2) 
with entropy.ch's php5 distribution? Read on: PART 2:

11) Check your shell's path variable by SHELL$ "echo $PATH". 
If your php5 binary directory is not listed before the standard OS X binary directory, 
update your $PATH variable to list it first. Mine reads: 
/usr/local/mysql/bin/: /usr/local/php5/bin/: /bin:/sbin: /usr/bin:/usr/sbin 
11a) if you do not do this step, the PECL extension will link against the old 
php4 version that ships with Mac OS X. You will know this by the fact that the 
next step lists a server API that is different than the output of phpinfo(): 
My version was 20041030, Apples version was 20020429.
12) Run: phpize && ./configure --with-ssh2 && make
This will produce a lot of output and probably some warnings. If you get a note 
at the end that says "Build Complete", then the process has completed 
(probably successfully). The command has produced the output file ssh2.so within 
the ssh2-0.9 (or whatever version) directory.
13) Check where the extension directory is located at by running the following command:
SHELL$/usr/local/php5/bin/php-config --extension-dir
If it lists some directory that actually exists, copy the ssh2.so file to this directory.
If it doesn't list a location that exists, you can either create the location, or 
choose a different location and update the line in your php.ini file:
extension_dir = "./"
to point to the directory you would like to use. I chose:
extension_dir = "/usr/local/php5/extensions/"?>
14) Add the line
extension=ssh2.so
to the Dynamic Extensions area of your php.ini file.
15) Restart your web server for the extensioin to be loaded. If there are any problems, they will be written to the webserver log.
16) Check if your new ssh based streams are available by running:
SHELL$ /usr/local/php5/bin/php -r "print_r(stream_get_wrappers());"
You should get something similar to this output:
Array
(
    [0] => php
    [1] => file
    [2] => http
    [3] => ftp
    [4] => compress.bzip2
    [5] => compress.zlib
    [6] => https
    [7] => ftps
    [8] => ssh2.shell
    [9] => ssh2.exec
    [10] => ssh2.tunnel
    [11] => ssh2.scp
    [12] => ssh2.sftp
)
You should now be able to do all the cool things you need to do with ssh 
(like sftp scp ssh execution)! Take a look at some of the comment here for some 
example scripts to test things out:
http://us2.php.net/manual/en/ref.ssh2.php

Good luck... hope that saves you my headache! :)
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.