Why won't SSH2 connect?

119 Views Asked by At

First of all please accept my apologies for my lack of understanding of the basics here. I am stuck with a problem and out of my depth.

We had a PHP script that was written by a long-gone member of staff. All it did was use ftp_ssl_connect() to connect to an FTP server and collect some files each evening. The problem is that the vendor who supplies the files has changed to an SFTP server and I need to amend our script.

We are using a hopelessly out of date version of PHP: 5.6.40-0+deb8u5. I can't change this, I'm afraid, not do I have access to install any libraries. On the other hand, phpinfo() shows that libSSH Version: libssh2/1.4.3 is installed. I also have access to webspace on Ionos which runs PHP version 8 and shows libSSH Version: libssh2/1.9.0 as being installed.

So my question is, why can't I get code like this to run?

$connection = ssh2_connect($server, $port);

if (ssh2_auth_password($connection, $username, $password)) {
    echo "connection is authenticated";
} else {
    echo "failed!";
}

It is as if ssh2_connect() just isn't recognized but the library is installed, isn't it?

I have also seen that I might be able to use Net_SSH but I have no idea where I am supposed to find the Included file from.

As I said, I'm really out of my depth so any help would really be appreciated.

Thanks.

0

There are 0 best solutions below