0

Hello I am trying to send file on a Sftp Server , I have made it with FTP but when i tried my code to send the file using SFTP it keep saying login failed on PHP and when I open Filezilla Server it said 500 Syntax error, command unrecognized. I have install

<?php
include('Net/SSH2.php');
include('Net/SFTP.php');


set_include_path(get_include_path().PATH_SEPARATOR.'phpseclib');
define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);

$sftp = new Net_SFTP('192.168.43.189', 21);

if(!$sftp->login('novtech', 'superhindd')) {
    echo $sftp->getSFTPLog();
    die('Login failed!');
} else {
    echo $sftp->pwd();
    echo $upload =  $sftp->put('download.xls', '/Users/Public/novtech/', NET_SFTP_LOCAL_FILE); 
}

  ?>

enter image description here

  • 1
    Looks like FileZilla is acting as a regular FTP server, not SFTP. It doesn't recognize the `SSH-2.0-phpseclib_1.0 (openssl, gmp)` identifier intended to start an SSH-handshake. According to [this forum post](https://forum.filezilla-project.org/viewtopic.php?t=48327), FileZilla does not support running as an SFTP server (or didn't in 2017, at least). – rickdenhaan Apr 29 '19 at 19:43
  • Also, `SFTP` usually runs on port 22 instead of 21. Did you perhaps mean [FTPS](https://stackoverflow.com/a/33062906/1941241) (which FileZilla *does* support)? – rickdenhaan Apr 29 '19 at 19:45
  • Thank you for taking time to respond, Yes I want to text it using Filezilla as an SFTP server, I tought Filezilla Server supported SFTP because I wanted to send File using SFTP not FTP. – DoctorDroid Haiti Apr 30 '19 at 15:08
  • 1
    Ok, you'll need to find something other than FileZilla Server. According to the [wiki](https://wiki.filezilla-project.org/FileZilla_FTP_Server): "Support for SFTP (SSH File Transfer Protocol) is **not implemented** in Filezilla Server." – rickdenhaan Apr 30 '19 at 18:56

0 Answers0