Hi all,


We are trying to use SFTP connection to remote host in our project. So for
that we are using SSH2 functions of PHP. But the script where we have used
those functions was throwing the following error:



*PHP Fatal error:  Call to undefined function ssh2_connect()  *

* *

By doing some work around we came to know that to remove this error we
mainly need 3 packages: OpenSSL, libssh2 and ssh2 modules.

Out of them OpenSSL module was present on the server. So we have installed
other two packages through procedure given on the link below :

http://hostechs.com/2008/07/installing-ssh2-for-php-shell-connections-how-to/
i.e.,



We have installed *“libssh2”* package using following set of commands :



[r...@box1 ~]wget
http://voxel.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.18.tar.gz
[r...@box1 ~]tar -zxvf libssh2-0.18.tar.gz
[r...@box1 ~]cd libssh2-0.18
[r...@box1 libssh2-0.18]# ./configure
[r...@box1 libssh2-0.18]# make
[r...@box1 libssh2-0.18]# make install



Then we have installed ssh2 module using following set of commands:

[r...@box1 ~]# wget http://pecl.php.net/get/ssh2-0.10.tgz
[r...@box1 ~]# tar -xzf ssh2-0.10.tgz
[r...@box1 ~]# cd ssh2-0.10
[r...@box1 ssh2-0.10]# phpize && ./configure --with-ssh2 && make



Then we have copied ssh2.so from
*“/home/amitdesh/ssh2-0.10/modules”*location to
*"/home/y/lib/php/20060613" *folder as this folder is mentioned as
*extension_dir
= "/home/y/lib/php/20060613" in php.ini file.*

Also we have added the following line in php.ini file to add the new ssh
extension:

*extension=ssh2.so*



But still by running our script we are getting the following error :



*PHP Warning:  PHP Startup: ssh2: Unable to initialize module*

*Module compiled with module API=20050922, debug=0, thread-safety=0*

*PHP    compiled with module API=20060613, debug=0, thread-safety=0*

*These options need to match*

* in Unknown on line 0*



Please let me know if anybody worked on SFTP in PHP and faced similar issue.




Thanks & Regards,

Sharat Ojha

Reply via email to