Question

I am using PHP , I want to connect to remote server in SFTP, but the website said: Fatal error: Call to undefined function ssh2_connect() in D:\xampp\htdocs\dive\database.php on line 9

Can you tell me in detail how to do this? I tired

<?php
$connection = ssh2_connect('ftp.server.com', 22); 
if (ssh2_auth_password($connection, 'username', 'password')) 
    echo "Authentication success";
else 
    echo "Authentication failure";
?>

But it doesn't work.

After I connect to the server, is there a difference if I want to insert some data to the table in it? Which function should I use?

Was it helpful?

Solution

Have you installed / verified via phpinfo() that ssh2 is installed? Quick Google search seems to indicate it is not by default PHP Install SSH2 on Windows machine

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top