Topics: programing, wordpress development | Tags: php5, ssh2, wordpress
If it does, you are in luck! Or your server (like mine hosting this blog) has FTP/FTPS disabled and only uses SSH2 for shell and file transfers, you are even more luck!
Working with the WordPress dev team in IRC (irc.freenode.net, #wordpress-dev) and after becoming frustrated that I couldn’t use the automatic plugin upgrade feature and the new core update feature that is coming out for version 2.7.x, I took it upon myself to start writing a SSH2 transfer protocol class file. Along with a few people in the channel (in particular DD32) we have completed this major task in getting it working. (Check the status of it’s progress in this trac ticket.)
There are a few requirements through for you to use it. First of all, you must have PHP5 installed at least. If you are still on PHP4, you can forget about it because you won’t be able to install the libssh2 class into your php config that you need for this to work. If you met the PHP5 min specifications and you do not have the libssh2 files installed, you gotta install it. Need help? Here are the instructions that we will be provided in the WordPress codex about it, but here is a very short version.
First of all, log into your server. You will need to do this as root. This has only been fully tested with libssh-0.14. Anything higher/lower we are unsure about it working.
cd /usr/src wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz tar -zxvf libssh2-0.14.tar.gz cd libssh2-0.14/ ./configure make all install
Do not leave the directory just yet as we have to do one more set to create the module file.
pecl install -f ssh2
After this step a file named ssh2.so will be created. Where ever this file is created copy it to the extensions directory that is specified under your php.ini file. In your php.ini file all you would have to do next is under extensions to load add:
extension=ssh2.so
Restart Apache/PHP and check phpinfo(); to see if it’s running. You should see under “Registered PHP Streams” these items:
- ssh2.shell
- ssh2.exec
- ssh2.tunnel
- ssh2.scp
- ssh2.sftp
If those are found, you go to the screen where you enter your hostname and password for automatic upgrading and there should be a SSH radio button to select. Now if your port for your SSH server is not the default 22, you may enter under hostname, your.host:yourport, and it will carry that over. One thing that I like to make clear. If you are using SSH connections only with authenticated keys, this will not work… yet. We haven’t worked on a way to select your SSH key files, so you can only use a plain text password authentication method for now.
With that in mind, we hope you enjoy this new feature of WordPress 2.7.x. I like to thank Kevin van Zonneveld also. His site was most helpful in getting the installation steps down and working on a secure method of checking to see if a command had completed or not. Report any error you might get in WordPress to WordPress trac site. I can deal with issues relating to installing libssh2 here though.



