php ssh2

#安裝
$ sudo apt-get install php-pear
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install ssh2 channel://pecl.php.net/ssh2-0.12
....
Build process completed successfully
Installing '/usr/lib/php5/20090626/ssh2.so'
install ok: channel://pecl.php.net/ssh2-0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.iniphp

<?php $connection = ssh2_connect('127.0.0.1', 22); ssh2_auth_password($connection, 'hei', '12345678'); $stream = ssh2_exec($connection, 'ls'); stream_set_blocking( $stream, true ); echo (stream_get_contents($stream)); ?> ssh

相關文章
相關標籤/搜索