简体   繁体   English

TideSDK PHP通过SSH连接

[英]TideSDK php connect via ssh

Are there any possibilities to connect to server via ssh using php in tidesdk. 是否有可能使用tidesdk中的php通过ssh连接到服务器。 I'm trying to use 我正在尝试使用

$session = ssh2_connect($server, 22);

But an error occurred 但是发生了错误

Fatal error - Call to undefined function ssh2_connect()

I'd recommend using phpseclib, a pure PHP SSH implementation . 我建议使用phpseclib,这是一个纯PHP SSH实现 eg. 例如。

<?php
include('Net/SSH2.php');

$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
    exit('Login Failed');
}

echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>

The fact that it's pure-PHP means it's ultra-portable. 它是纯PHP的事实意味着它是超便携式的。 Unlike the libssh2 extension you're currently trying to use. 与您当前尝试使用的libssh2扩展不同。

Have you installed the SSH2 extension? 您安装了SSH2扩展程序吗?

http://ie1.php.net/manual/en/ssh2.installation.php http://ie1.php.net/manual/en/ssh2.installation.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM