0

I am trying to Connect and Handle Files in SFTP Server using PHP. But i am getting error ssh2_connect Fatal error: Uncaught Error: Call to undefined function ssh2_connect(). If I installed SSH2 extension will it work for PHP 7 or any other option need.

try
{
$sftp = new SFTPConnection("HOST", 22);
$sftp->login("UN", "PWD");
$sftp->uploadFile("/tmp/to_be_sent", "/tmp/to_be_received");
}
catch (Exception $e)
{
echo $e->getMessage() . "\n";
}
xvxvcx
  • 1
  • 1
    https://stackoverflow.com/questions/14050231/php-function-ssh2-connect-is-not-working/14129102 – John Lobo May 26 '21 at 12:43
  • 1
    We recently had a project that needed SFTP using keys and after fighting the SSH extension, we switched to this [userland implementation](https://phpseclib.com/docs/sftp) and it has been working flawlessly. – Chris Haas May 26 '21 at 13:05

0 Answers0