ssh2: Unable to initialize module

5.6k Views Asked by At

I install ssh2 on my server but when i check the result is :

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

I uses centos 6 and directadmin

2

There are 2 best solutions below

1
On

libssh2 is notoriously difficult to install. Personally, I would recommend you try phpseclib, a pure PHP SSH2 implementation.

1
On

You could try to install ssh2 through yum, enabling remi.repo if required:

$ sudo yum install php-pecl-ssh2

It will install php-pecl-ssh2 package of the same version as your PHP is.

But it also possible to install it through pecl if you have any reasons to do it:

  1. # yum install php-devel

  2. # pecl channel-update pecl.php.net

  3. # pecl install ssh2

Tested for Oracle Linux 7.