Question

Are there any possibilities to connect to server via ssh using php in tidesdk. I'm trying to use

$session = ssh2_connect($server, 22);

But an error occurred

Fatal error - Call to undefined function ssh2_connect()
Was it helpful?

Solution

I'd recommend using phpseclib, a pure PHP SSH implementation. 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. Unlike the libssh2 extension you're currently trying to use.

OTHER TIPS

Have you installed the SSH2 extension?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top