Question

Can't install Wordpress themes - FTP Error

Posted August 13, 2014 76k views

Hey all,

Newbie to development here.

I’m getting this error when I try to install a theme from Wordpress: “Failed to connect to FTP Server”.

It’s asking me for my hostname, username, and password which I put in (checked to see if they are correct from Transmit 2 and SSH).

What I find weird is that Transmit connects to SFTP through port 22 (which I thought was dedicated to SSH) and when I try to connect through port 21 (which Wordpress tries to do) it fails.

If it helps – I installed Wordpress using the Ubuntu 14.04 guide. Another thing: I think I installed my original droplet with the LAMP stack, but then installed it again with the LAMP Stack Guide for Ubuntu 14.04, don’t know if that would cause these sorts of problems.

Any help would be much appreciated! Thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

8 answers

You don’t need FTP for installing a theme.
Open wp-config.php file into Wordpress root installation folder and add

define('FS_METHOD', 'direct');

It should works.

I can confirm that the following command worked (for me)

chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;

I faced the same problem. Apparently Ubuntu only allows SFTP. Have you got your SSH public and private keys set up? If not, try this link, solved it for me

https://www.digitalocean.com/community/tutorials/how-to-configure-secure-updates-and-installations-in-wordpress-on-ubuntu

by Justin Ellingwood
WordPress is the most popular content management system (CMS) on the web currently. While WordPress can be a great way to manage you content, there are some very insecure configurations that are given throughout the internet. This article will cover how to set up secure updates and installations using SSH keys instead of FTP, which is an inherently insecure protocol.

chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;

Worked for me toooo! Thanks!

Use this code , wordpress asking for ftp details because wordpress doesn’t have permission to write in your server.
use these two commands in terminal.

$sudo a2enmod rewrite
$sudo chown -R www-data /var/www

video guide https://www.youtube.com/watch?v=RGGWVUIvhnk

hello i delete one droplet but still, IP redirect http://134.209.220.171 to mytechtalk

I can confirm that adding define(‘FS_METHOD’, 'direct’); to wp-config.php worked for our Roofers Dublin website on Wordpress! Thanks for your help.

Submit an Answer