1

I have followed the instructions here: PHP Install SSH2 on Windows machine amongst other places.

Please note I am at work and cannot change this development environment.

Using

if (extension_loaded('ssh2')) 

I can see the extension has not been loaded.

  • I tried using both the TS and NTS files from here: http://windows.php.net/downloads/pecl/releases/ssh2/0.12/ for PHP 5.3 (I am version 5.3.5).

  • I am have placed php_ssh2.dll and php_ssh2.pdb files in the correct ext folder for PHP (I have confirmed this is the right ext folder using the phpinfo() command).

  • I have added extension=php_ssh2.dll to the php.ini file, again ensuring it's the right ini file using the phpinfo() command

  • I have added libsshl2.dll to both syswow64 and system32 folders

  • When I try to register either of those using command line prompts it fails but I have been told by my other question this is because libssh2.dll is not a COM server so cannot be registered - How do I register a php dll with windows if it's 64 bit windows but 32 bit php and apache? I have tried running the commands as the administrator

  • Apache has been restarted. There is nothing in the error log.

Please help, tearing my hair out over this one

Community
  • 1
  • 1
Hard worker
  • 3,916
  • 5
  • 44
  • 73

2 Answers2

1

honlestly i think youd be better off with phpseclib. libssh2 is notoriously difficult to use. its not well maintained and isnt even as feature packed as phpseclib is. more info on the advantages of phpseclib over libssh2:

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

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');
?>
raython
  • 11
  • 1
0

Take a look at this answer. It seems that for each version of php, you will have the exactly version of ssh2. You cannot run a ssh2 dll if it is not built with that php version

So check the version out, pay attention that there are two download links, for 32 or 64. https://stackoverflow.com/a/16480426

Community
  • 1
  • 1
LeoPucciBr
  • 151
  • 1
  • 10