Home >Backend Development >PHP Tutorial >PHP SSH2简单实例

PHP SSH2简单实例

WBOY
WBOYOriginal
2016-06-23 14:28:562246browse

1.摘自:http://cn.php.net/

$connection  =  ssh2_connect ( 'shell.example.com' ,  22 );
ssh2_auth_password ( $connection ,  'username' ,  'password' );

 

ssh2_scp_send($connection, '/local/filename', '/remote/filename', 0644);
?>

2.如果本地PHP不支持SSH2

摘自:http://www.asim.pk/2010/05/27/installing-phps-ssh2-extension-on-ubuntu/

sudo apt-get install libssh2-1-dev libssh2-php

重新启动apache

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn