Extension ssh2 PHP

xalupeao

Verified User
Joined
Nov 25, 2009
Messages
16
Location
Santiago, Chile
ssh2_exec().

falls on a bucle, not receive a response ...

PHP:
<?
        #obtenemos las variables
        $ip             = "xxx.xxx.xxx.xxx";
        $puerto         = "22";
        $usuario        = "root";
        $password       = "XXXXXX";

        #nos conectamos al servidor
        $conexion       = ssh2_connect($ip,$puerto);

        #probamos la conexion
        if($conexion){
                #enviamos el mensaje
                print 'Se conecto al servidor '.$ip.' como '.$usuario.'<br>';
                #autentificamos nuestro usuario

                if(ssh2_auth_password($conexion,$usuario,$password)){
                        #enviamos el mensaje
                        print 'Se autentifico con exito<br>';
                                                #ejecutamos el comandos
                                                $load= ssh2_exec($conexion,'uptime',false);
                                                stream_set_blocking($load, true);
                                                $load = stream_get_contents($load);
                                                #obtenemos el uptime
                                                print $load;
                                                $load = split("load average:", $load);
                                                $load = split(", ", $load[1]);
                                                $load = $load[0];
                                                echo "Current Load: $load <br>";       

                }else{
                        #enviamos el mensaje
                        print 'La combinación usuario/contraseña no es correcta!<br>';
                }
        }else{
                #enviamos el mensaje
                print 'ERROR: al intentar conectar con el servidor '.$ip.'<br>';
        }
?>

..............

[root@localhost]# php -m
[PHP Modules]
bcmath
calendar
ctype
curl
date
dom
filter
ftp
gd
gettext
hash
iconv
ionCube Loader
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
Reflection
session
SimpleXML
sockets
SPL
SQLite
ssh2
standard
tokenizer
xml
xmlreader
xmlwriter
Zend Optimizer
zip
zlib

[Zend Modules]
Zend Extension Manager
Zend Optimizer
the ionCube PHP Loader


php.ini

extension = ssh2.so [OK]

Plz help! me.
 
Last edited:
I took the liberty to change the password and send the poor guy the new one... I also checked and no one entered before me, this guy really is lucky.
 
You are welcome.

No, I'm sorry. Also, this is a DirectAdmin control panel support forum, I don't think it's the right place for your problem.
 
Neither the script or ssh2.so are inherent to this forum.
Google Translate :): Ni el script o ssh2.so son inherentes a este foro.
 
Back
Top