At White Whale I maintain several libraries of code which involve performing tasks over FTP. PHP has an FTP extension that works pretty well for FTP-related code. The major flaw with it is that it only supports FTP and FTP+SSL. As we start working more and more with SFTP servers, many of these libraries needed to add SFTP support.
There is an SSH2 module that requires a little more effort to set up on your web server, but enables support for SFTP servers. The question is then, how can I integrate this extension and its features into an existing FTP codebase in an efficient manner? Furthermore, the SSH2 module’s syntax is not as straightforward for basic FTP tasks as the actual FTP extension is.
The answer is really pretty simple. Read more »