-1

When I check my php version I get the following warnings:

PHP Warning:  PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20121212
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

I'm trying to understand which versions work together and how I can get hold of the correct version to setup PHP with SSH2. I have been able to find the .tar.gz versions of libssh from places like the following:

https://www.rpmfind.net/linux/RPM/remi/enterprise/6/x86_64/php56-php-pecl-ssh2-0.12-4.el6.remi.x86_64.html

The problem is I am using a Windows machine and not Linux. Does anyone know whether I can get the same libssh version for Windows? Or do I have to downgrade PHP to the same level as ssh2? Or is it nothing to worry about it and just a quirk of Windows?

Here are some details that might be of use:

OS: Windows 10 (x64)
PHP Version: PHP 5.6.15 (cli) (built: Oct 29 2015 12:39:50)
Microsoft Visual C++ 2015 Redistributable (x64) 11.0.61030
Server version: Apache/2.4.17 (Win64)
Apache Lounge VC11 Server built:   Oct 13 2015 11:37:51

In addition... I've found the version of the ssh2 zip that I downloaded. It was 5.5 Thread Safe (TS) x64 from: https://pecl.php.net/package/ssh2/0.12/windows So, I guess that means I need to downgrade my PHP to 5.5 for this to work properly. Is that correct or is there a better way?

BebopSong
  • 284
  • 1
  • 4
  • 8
  • 1
    no, it's not a windows quirk. you're trying to load a dll compiled against (say) php 5.2, while running a newer (maybe 5.3/5.4?) version. you'd get the exact same warning if you tried the same thing with a linux .so file. – Marc B Dec 10 '15 at 20:03
  • One can only wish that Microsoft one day succeeds in creating a package management system as it is proved and used on a daily base in other operating systems and solved such issues 15 years ago. I mean they copied everything else in the last 10 years. Why not that? – arkascha Dec 10 '15 at 20:03

1 Answers1

-1

I've found a solution to the problem. As stated in the OP the problem was that the PHP module was a later version than the SSH2 module. The question was how to find the versions that would work with the setup stated. This proved to be quite tricky because there were more systems that needed to be integrated than I first thought. I falsely assumed that the latest versions would all play nice together.

As I am running Windows 10 64-bit I wanted to get the stable version of PHP that runs against this - that would be PHP 7. As stated here: http://windows.php.net/download/. Initially I downloaded PHP 7.0 but this didn't play nicely with another module that I wanted to install, which was MongoDB.

When I looked into MongoDB I realised that there wasn't a driver for PHP 7.0 yet so the latest one I could get was PHP 5.6. This meant that I had to settle for an "experimental" 64-bit version of PHP. So I made the shift and everything was playing nice until I decided that I wanted to get Composer so that I could manager my PHP dependencies.

When I tried to intall Composer using the Windows installer it failed with an unknown exception and suggested I try from the command line to get a better error response. So I duly did and the error stated that the ssh2 module was not compatible with PHP 5.6.

That eventually brought me to ask the question on stackoverflow.

After some more digging into what versions of ssh2 there are I was brought to the following page: http://windows.php.net/downloads/pecl/releases/ssh2/0.12/ This told me that the latest version of PHP that was compatible with the SSH2 extension was PHP 5.5. So... it looks like the solution was to downgrade to version 5.5.

When I started looking for the new (old) version to download I came across this wonderful bundle package site: https://www.apachelounge.com/viewtopic.php?t=6123 From there I could download this version (https://phpdev.toolsforresearch.com/php-5.5.20-Win32-VC11-x64.zip) and it would contain all the modules that I needed in the correct version.

So, in conclusion, a little more up-front analysis into what versions play nice together would have helped or understanding that the Apache Lounge has all the versions that work together in a nice tidy bundle.

BebopSong
  • 284
  • 1
  • 4
  • 8