1

Debian : 7.4

I have some difficulty to make ssh2 work with php5. i didn't find a solution on other topics and i search a LOT ! all has been well installed according to debian outputs but it still doesn't work.

This is what i'v done

Package installed : - php5 - php5-dev - libssh2-php - libssh2-1-dev

I used PECL to install pecl install -f ssh2 I just press enter for auto prefix.

And extension=ssh2.so to /etc/php5/apache2/php.ini

Restart more than one time apache2.

But the package ssh2 still not appear in output of php -m and says that ssh2_connect is undefined

I totally out of resources to make it works, so please can anybody helps me ?

Here some info provided by phpinfo() :

extension_dir   /usr/local/lib/php/extensions/no-debug-non-zts-20100525/

extension version   0.12
libssh2 version 1.4.3
banner  SSH-2.0-libssh2_1.4.3

If you need i can give more informations

nurb
  • 11
  • 1

1 Answers1

1

I use phpseclib's libssh2-compatibility-layer to avoid having to install libssh2. You can use all the libssh2 functions without having it installed thanks to the use of phpseclib.

If you're writing your application from scratch maybe try just using phpseclib from the onset intsead of libssh2.

  • Thank you for your reply, I try you solution but it still an error. Notice: Connection closed by server in /usr/local/lib/php/Net/SSH2.php on line 1009 Notice: Connection closed prematurely in /usr/local/lib/php/Net/SSH2.php on line 3143 Do you know how to fix it ? – nurb Nov 18 '14 at 17:17
  • Line 1009 is in the part of phpseclib where the initial connection is being made. The SSH server should broadcast it's version to people who might connect. eg. SSH-2.0-whatever. From the line numbers it sounds like your server isn't doing that. Are you sure you're connecting to an SSH server? What port are you connecting on? – compoboodle Nov 18 '14 at 21:18