Note: This is an update of my previous post about enabling SFTP for WordPress available here.
I updated to Ubuntu 10.04, also known as Lucid Lynx, on my server and SFTP in PHP applications stopped working. Turns out that the pecl build isn’t compatible with the version of PHP shipped with 10.04, as far as I can tell. I tried reinstalling it, but it wouldn’t build. Thankfully I found out that there’s a package of it available in the repos.
Here’s the new method to enable SSH in PHP, which makes SFTP in WordPress work again.
user@computer:~$ sudo apt-get install libssh2-php
Restart Apache and you’re on your way. Way simpler than before is just a nice bonus.

I don’t like to use FTP at all when I can help it. It’s an old protocol and doesn’t hold up in regards to security. I could use FTPS, which is a Secure Sockets Layer over FTP, requiring a key exchange, but frankly, that sounds like too much work for me. Since I already use SSH and SSH has file transfer capability, I usually use that to manage things. It’s commonly called SFTP. Unfortunately, this breaks many apps that expect you to be using FTP, such as WordPress.