RE: [PHP] Requires help: Unable to install ssh2 module in PHP.
| From: | Tommy Pham | Date: | Tue, 27 Jul 2010 06:07:45 +0000 |
| Subject: | RE: [PHP] Requires help: Unable to install ssh2 module in PHP. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307142@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Sharat Ojha [mailto:ojhasharat@gmail.com]
> Sent: Monday, July 26, 2010 9:43 PM
> To: php-general@lists.php.net
> Subject: [PHP] Requires help: Unable to install ssh2 module in PHP.
>
> 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.,
Sharat,
Wrong reference source to begin with?? Try this:
http://www.php.net/manual/en/ssh2.requirements.php
>
> We have installed *“libssh2”* package using following set of commands :
>
>
>
> [root@box1 ~]wget
>
> http://voxel.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.18.tar.gz
> [root@box1 ~]tar -zxvf libssh2-0.18.tar.gz
> [root@box1 ~]cd libssh2-0.18
> [root@box1 libssh2-0.18]# ./configure
> [root@box1 libssh2-0.18]# make
> [root@box1 libssh2-0.18]# make install
>
http://sourceforge.net/projects/libssh2/
Current version of libssh2 on sourceforge is 1.1 (released 2009.04.02) .... seems like you're
using a very outdated version...
>
>
> Then we have installed ssh2 module using following set of commands:
>
> [root@box1 ~]# wget http://pecl.php.net/get/ssh2-0.10.tgz
> [root@box1 ~]# tar -xzf ssh2-0.10.tgz
> [root@box1 ~]# cd ssh2-0.10
> [root@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*
>
And thus, the mismatch version problem... I figure you're probably doing this on Linux. If
you're compiling on *BSD, the ports build will fetch the appropriate dependencies for you when
you build the main port from the tree ;)
Regards,
Tommy
>
>
> Please let me know if anybody worked on SFTP in PHP and faced similar issue.
>
>
>
>
> Thanks & Regards,
>
> Sharat Ojha