apt-get install libssh2-1-dev libssh2-php
service apache2 restart
安装完成之后,可以使用SCP远程复制文件:
$connection = ssh2_connect("192.168.1.1",22);
if(ssh2_auth_password($connection,"aaa","pass"))
{
echo "Authentication Successful! ";
}else{
die("Authentication Failed...");
}
$ret = ssh2_scp_send($connection,'/var/www/aaa', '/var/www/aaa');