1

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()
Alex
  • 59
  • 2
  • 7

2 Answers2

2

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.

neubert
  • 15,947
  • 24
  • 120
  • 212
0

Have you installed the SSH2 extension?

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

Paul Bailey
  • 146
  • 5
  • For sure it is installed in my system, but not in tidesdk. I can execute same script in browser without any errors. – Alex Jul 22 '13 at 17:12