Skip to main content
cPanel Technical Support has been heavily impacted by hurricane Beryl and our ability to respond to tickets has been hindered as a result. We appreciate your understanding and patience as we address these delays.

Problems Installing PHP SSH2 in order to use SFTP functions

Comments

7 comments

  • cPRex Jurassic Moderator
    Hey there! The output of the message indicates the problem - that specific pecl package is only available for PHP versions higher than 4 and lower than 6, which would mean you'd need to be using PHP 5.6 or older on cPanel in order to get that installed. The package is not available for newer versions of PHP, so it would be best to find a different piece of software that supports more modern installations.
    0
  • adamcm
    Thanks for your reply. I guess that was my question - if this is not the way to get sftp connections to work in the latest versions of PHP, what is? Thanks
    0
  • cPRex Jurassic Moderator
    I see this has to be installed manually as a modern version isn't included from pecl directly. You can run this command to perform that work, just modifying the php## to work with your particular version. For example, this works with PHP 7.4: /opt/cpanel/ea-php70/root/usr/bin/pecl install https://pecl.php.net/get/ssh2-1.2.tgz
    Can you try that and let me know if that works?
    0
  • adamcm
    Thank you, that worked and it installed successfully. However, when attempting to use the ssh2_connect function, I receive the following error: Error starting up SSH connection(-5): Unable to exchange encryption keys
    0
  • cPRex Jurassic Moderator
    Well, we made some progress at least! For how to use the function, that part I can't be of much assistance with. I'm assuming you have libssh2.1.8 or higher on your system, correct? If so, I'd expect things to work well. There were some older bug reports on this (PHP :: Bug #57062 :: Error starting up SSH connection(-5): Unable to exchange encryption keys) but I don't see anything recent about this exact issue.
    0
  • adamcm
    Forgive me, I don't know how to check or update libssh, is there a command to do this? Thanks
    0
  • cPRex Jurassic Moderator
    Sure thing - you can run this on the command line through SSH or through the WHM >> Terminal: rpm -qa | grep libssh
    If you have automatic updates enabled on the system, it's likely you already have the latest available.
    0

Please sign in to leave a comment.