kat35601 Posted June 27, 2022 Share Posted June 27, 2022 Provider changed there security settings and now I am not able to connect. I get this error "ssh2_connect(): Error starting up SSH connection(-5): Unable to exchange encryption keys " these are the keys they except now. how to I tell ssh_connect() to use one of these try { $connection = ssh2_connect($db['cit_host'], $port); if(!$connection){ throw new \Exception("Could not connect to $host on port $port"); } $auth = ssh2_auth_password($connection, $user, $pass); if(!$auth){ throw new \Exception("Could not authenticate with username $user and password "); } $sftp = ssh2_sftp($connection); if(!$sftp){ throw new \Exception("Could not initialize SFTP subsystem."); } $stream = fopen("ssh2.sftp://" .(int)$sftp.'//Inbox//'.$remoteFile, 'w'); if (! $stream) { echo "<td>$sftp$remoteFile</td>"; throw new \Exception("Could not open file: "); } $file = file_get_contents($remoteFile); if (fwrite($stream, $file) ===FALSE){ echo "File Not Written"; Quote Link to comment https://forums.phpfreaks.com/topic/314963-ssh2_connect-error-starting-up-ssh-connection-5-unable-to-exchange-encryption-keys/ Share on other sites More sharing options...
requinix Posted June 27, 2022 Share Posted June 27, 2022 Odds are the versions of openssl and/or libssh installed on your system are out of date. Update them. Quote Link to comment https://forums.phpfreaks.com/topic/314963-ssh2_connect-error-starting-up-ssh-connection-5-unable-to-exchange-encryption-keys/#findComment-1597646 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.