How To SFTP With PHP
I'm interested in trying to get SFTP working with the following PHP method: ftp_ssl_connect(host,port,timeout);
I notice that on W3CSchools (http://www.w3schools.com/php/func_ftp_ssl_connect.asp) there is the following note:
Note: This function is only available if both the ftp module and the OpenSSL support is built statically into PHP.
I am left with the question as to how to "build statically" both the "ftp module" and "OpenSSL support" into PHP. I have googled around and there seems to be very sparse information on this subject.
When I currently try to run the code from W3CSchools with legitimate credentials, I constantly get "false" returned. I can successfully SFTP in with the same credentials and port I am using with PHP, so that isn't the problem.
I realize there is another similar question on StackOverflow; however, that question does not even mention nor give an explanation as to how to use the PHP function ftp_ssl_connect() and I would still like to know how to use it and when to use it.
Answer
SFTP (not to be confused with FTPS) is a tool provided by the OpenSSH suite (and other implementations) to securely transfer files over an SSH connection. It is in no way related to FTP or FTPS, which is what the function you're using is for.
You are probably looking for https://secure.php.net/manual/en/function.ssh2-sftp.php and the other related functions.
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?