ssh2_connect Problem

Fatal error: Call to undefined function ssh2_connect() in /opt/lampp/h

Page 1 of 1

4 Replies - 31655 Views - Last Post: 27 April 2007 - 03:13 PM Rate Topic: -----

#1 richtown  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 23-April 07

ssh2_connect Problem

Posted 27 April 2007 - 10:38 AM

When running the following code it results in the error below
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?> 



Fatal error: Call to undefined function ssh2_connect() in /opt/lampp/htdocs/i.php on line 3

Am i missing a library file in PHP? Ive tried to install a new extension file in PHP.INI but this didnt seem to work

Thanks Rich.

Is This A Good Question/Topic? 0
  • +

Replies To: ssh2_connect Problem

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: ssh2_connect Problem

Posted 27 April 2007 - 11:49 AM

Yes, you are likely missing the extension.
Was This Post Helpful? 0
  • +
  • -

#3 richtown  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 23-April 07

Re: ssh2_connect Problem

Post icon  Posted 27 April 2007 - 12:16 PM

Ive installed Opens SSL and libssh2 and run "./configure" "make" "make install" on them. The next part

Copy ssh2.so from the directory indicated by the build process to the location specified in your php.ini file under extension_dir


I can't locate ssh2 from the directory, ive tried whereis ssh.so. How do i locate this file and add it to extension in PHP.INI

ive only just started using linux so im not to hot,
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1868
  • View blog
  • Posts: 20,280
  • Joined: 17-March 01

Re: ssh2_connect Problem

Posted 27 April 2007 - 12:20 PM

You can type locate ssh.so after you run an updatedb which should update the file database. If it's on the server, locate will find it.
Was This Post Helpful? 0
  • +
  • -

#5 richtown  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 23-April 07

Re: ssh2_connect Problem

Posted 27 April 2007 - 03:13 PM

Ok ive manages to install SSH2 and locate ssh2.so

/usr/local/lib/libssh2.so
/usr/local/lib/php/extensions/ssh2.so
/usr/local/lib/php/extensions/ssh2.so/ssh2.so
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ssh2.so
/opt/lampp/lib/php/extensions/ssh2.so
/root/Desktop/libssh2-0.14/src/libssh2.so
/root/Desktop/ssh2-0.10/modules/ssh2.so
/root/Desktop/ssh2-0.10/.libs/ssh2.so


But which one do i want to copy and where do i copy it to? would it be /opt/lampp/lib/php/extensions/ssh2.so?

and how do i add the extension to php.ini (extension_dir=?)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1