ssh_connect

KenHorse

Member
I've been using the following script snippet to connect to a remote server in order to run lm-sensors on the remote server and it's worked fine (I've changed the IP and password for this post of course)

Code:
$connection = ssh2_connect('xxx.xxx.xxx.x', 22);
ssh2_auth_password($connection, 'root', 'xxxxxx');

if($output = ssh2_exec($connection, 'sensors')) {
    stream_set_blocking($output, true);
        $x = stream_get_contents($output);
}

This script runs on a Debian 10 machine and the remote server USED to also be Debian 10 but it was recently upgraded to Debian 12 (Bookworm) and now the script reports the following errors:

Code:
PHP Warning:  ssh2_connect(): Error starting up SSH connection(-5): Unable to exchange encryption keys in /var/www/html/get_temp.php on line 3
PHP Warning:  ssh2_connect(): Unable to connect to xxx.xxx.xxx.x in /var/www/html/get_temp.php on line 3
PHP Warning:  ssh2_auth_password() expects parameter 1 to be resource, bool given in /var/www/html/get_temp.php on line 4
PHP Warning:  ssh2_exec() expects parameter 1 to be resource, bool given in /var/www/html/get_temp.php on line 6

I'm not a total newbie to Linux but I'm no expert either so help would be appreciated
 
Back
Top