Enabling WordPress SFTP (SSH) Updates

This article describes how to update PHP to allow WordPress to do updates through SFTP (SSH)

WordPress traditionally only seems to allow updates to be done via FTP or FTPS. If you are self hosting or your host does not allow for FTP access (for very good reasons) then updates via SFTP (through SSH) will need to be enabled. Interestingly enough this option is built into WordPress, but it is rarely ever mentioned and the option is hidden by default if PHP does not have the necessary SSH2 module installed.

Installing the module for Centos is fairly straightforward.

First you will need a compiler installed. If you have gcc installed this can be skipped, otherwise install it. For 64 bit systems you will likely want to add .x86_64 to all of the package names, otherwise 32 bit packages will be installed as well.

yum install gcc

-or-

yum install gcc.x64_64

Next the libssh2 libraries need to be installed. This can be done (as root) with the following command

yum install libssh2-devel

Next, php-pear needs to be installed (do not add .x64_64)

yum install php-pear

You should now be able to install the PHP SSH2 package.

pecl install -f ssh2-beta

When prompted for the path to libssh2 just hit enter.

You then need to add the SSH2 package to the php.ini file. This is typically located at /etc/php.ini. Add the following line in the section with the other extensions

extension=ssh2.so

Lastly you need to restart Apache so PHP will reload its configuration. This is done by restarting httpd

service httpd restart

One thought on “Enabling WordPress SFTP (SSH) Updates

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">