0

I do as some material say.
1. download php extension ssh2 from
http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
i select php_ssh2-0.12-5.4-ts-vc9-x86.zip to download.
2. extract the downloaded file
there are thress files :libssh2.dll、php_ssh.dll、php_ssh2.pdb .
3. save php_ssh.dll and php_ssh2.pdb in the php/ext/.
4. save libssh2.dll in the c:/windows/system32 and c:/windows/syswow64 .
5. edit php.ini
to add a line: extension=php_ssh2.dll
6. reboot apache .

But there is no ssh2 info in my output of phpinfo().
Why can't install php-ssh2 on my win7?

showkey
  • 482
  • 42
  • 140
  • 295

1 Answers1

1

Trying to use libssh2 is a PITA as you're finding out. I'd just use phpseclib, a pure PHP SSH implementation. Example:

<?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');
?>

It has a number of advantages over libssh2:

http://phpseclib.sourceforge.net/ssh/compare.html

  • Warning: include(Net/SSH2.php): failed to open stream: No such file or directory in C:\wamp\www\connect.php on line 2 – showkey May 20 '15 at 07:49
  • Warning: include(): Failed opening 'Net/SSH2.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\connect.php on line 2 – showkey May 20 '15 at 07:50
  • Fatal error: Class 'Net_SSH2' not found in C:\wamp\www\connect.php on line 4 – showkey May 20 '15 at 07:50