CentOS 5 – PHP SSH2

Necesitaremos tres paquetes: openssl, libssh2 y ssh2
Comprobamos si tenemos openssl instalado:
[root@box1 ~]#rpm -qa |grep openssl
Si sale algo así lo tenemos ok
openssl096b-0.9.6b-22.46
openssl-0.9.7a-43.17.el4_6.1
openssl-devel-0.9.7a-43.17.el4_6.1
Las versiones difieren según la instalación. Sino lo tenemos lo instalamos:
yum install openssl (redhat OS)
apt-get install openssl (debian OS)
El segundo paquete es el libssh2.
[root@box1 ~]wget http://downloads.sourceforge.net/project/libssh2/
old-libssh2-releases
/1.1/libssh2-1.1.tar.gz?use_mirror=freefrhttp:
//downloads.sourceforge.net/project/libssh2/old-libssh2-releases
/1.1/libssh2-1.1.tar.gz?use_mirror=freefr
[root@box1 ~]tar -zxvf libssh2-1.1.tar.gz
[root@box1 ~]cd libssh2-1.1
[root@box1 libssh2-0.18]# ./configure
[root@box1 libssh2-0.18]# make
[root@box1 libssh2-0.18]# make install
Ahora necesitamos instalar el módulo ssh para PHP
[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
Si finaliza sin errores ya lo tenemos instalado, faltaría añadir la extensión en el php.ini
extension=ssh2.so
Si nos encontramos un error como este:
*** [ssh2.lo] Error 1
Tendremos que hacer una pequeña modificación:
[root@box1 ssh2-0.10]# vi ssh2.c
Busca la linea
#if LIBSSH2_APINO < 200412301450
y editala así:
#if LIBSSH2_VERSION_NUM < 0x001000
Salva el archivo y vuelve a ejecutar: phpize && ./configure --with-ssh2 && make
Links
- http://hostechs.com/2008/07/installing-ssh2-for-php-shell-connections-how-to/comment-page-1/#comment-59
- http://stackoverflow.com/questions/561024/install-pecl-ssh2-extension-for-php
- http://forums.vpslink.com/centos/1682-installing-php-ssh2.html
- http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/






