PHP Install Ssh2 on Windows Machine

Missing php_ssh2.dll extension for php 7.2 (windows)

On Windows, PHP 7.2.x is built using VC15 and the latest SSH2 module is v1.1.2 which was built on VC14.

So you need to either downgrade to PHP 7.1.x or wait for the PHP team to compile SSH2 in VC15.

Additionally, I have no experience with this but you could decide to compile it yourself in VC15 if you are comfortable with that sort of thing.


Update:

SSH 1.1.2 now has a VC15 build at https://windows.php.net/downloads/pecl/releases/ssh2/1.1.2/

The latest SSH is 1.2 which currently has PHP 7.1-7.4 builds: https://windows.php.net/downloads/pecl/releases/ssh2/1.2/

Installing ssh2 on xampp

A couple of things you may have missed :-

  • You need the Thread Safe (-ts-) version of php_ssh2
  • You need to make sure you get the 32 or 64 bit version to match your PHP/Apache and not to match your OS
  • You need the version of php_ssh2 that matches your PHP version i.e. 5.4

Having a look here for the download there is only a 32bit version of SSH2 compiled with VC9 available for PHP5.4, so you will have to ensure you have the 32bit version of XAMPP installed.

Oh and a final note, you do not need, and should not do, the copy of php_ssh2.dll into the c:\windows\system32 so remove the dll from this folder. PHP knows where to load its extensions from and putting files in c:\windows\system32 will only confuse things when you want to upgrade your version of XAMPP.

How to install ssh2 for php 7.3

Theres an existing report on bugs.php.net, where user goldorakhong commented to compile it from source.

Using a docker file this can be done so:

RUN cd /tmp \
&& git clone https://git.php.net/repository/pecl/networking/ssh2.git \
&& cd /tmp/ssh2/ \
&& .travis/build.sh \
&& docker-php-ext-enable ssh2

If your not using docker you'll need to substitute docker-php-ext-enable to register the variable somehow else.



Related Topics



Leave a reply



Submit