PHP Install SSH2 on Windows machine

96,500

Solution 1

Here's how I did it:

  1. Downloaded Win32 SSH2 PECL extension from this location (choose the appropriate version);

  2. Extracted the archive's content and:

    • placed php_ssh2.dll and php_ssh2.pdb files in the ext folder (e.g. C:\php\ext);
    • copied libssh2.dll file to C:\Windows\system32 and (if you got Win64) C:\Windows\SysWOW64 folder(s);
  3. Run the following command to register the DLL:

    C:\> regsvr32 libssh2.dll
    
  4. Restarted Apache.

Final note

If you got PHP x64, you have to lookup for the x64 version of the SSH2 library / DLLs. This site offers some Win64 compiled libraries for PHP, try here first.

Hope this helps.

Solution 2

If anyone is having trouble installing SSH2, here's how I did it:

1) Download SSH2 PECL library from PHP.net [choose the appropriate version].

2) Copy libssh2.dll to System32 [x86] or SysWOW64 [x64] folder.

3) Copy php_ssh2.dll and php_ssh2.pdb to php/ext folder.

4) Remove ';' from the ;extension=php_ssh2.dll line in php.ini. If this line is not on your php.ini, add it.

5) Restart Apache.

Solution 3

  1. Place php_ssh2.dll in ext folder
  2. Place libssh2.dll in php folder
  3. Restart IIS

that work for me

  • PHP 5.4.25 NTS + Windows Server 2012

Solution 4

If you are running xamp 3.2.1 and PHP 5.6.8, this could be helpful for you.

Do what alex b said, and download the package that corresponds dependindg your php version (and bits) from this page (link)

I've downloaded and replaced in C:\xampp\php\ext and it worked!

Hope this helps, regards.

Solution 5

libssh2 (deps): http://windows.php.net/downloads/php-sdk/deps/

php_ssh2 (ext): http://windows.php.net/downloads/pecl/releases/ssh2/0.12/

Versions prior to 5.5 has already the libssh2.dll (from the second link)

Share:
96,500
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I am trying to install this on a Windows+Apache machine. Documentation says that SSH2 requires the OpenSSL and libssh2 libraries. I have added this lines in my php.ini file:

    extension=php_openssl.dll
    extension=php_ssh2.dll
    

    and restarted Apache but it still not working (Fatal error: Call to undefined function ssh2_connect()).

    Can anyone explain me how to install this service?