WordPress VPS FTP Connection Problem

When you try to install or upgrade a plugin in WordPress, you will see this message



Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.


If you enter your default root login and password, you will get this error message

Failed to connect to FTP Server mydomain.com:21

The error will always add :21 to whatever you type in the Hostname box.

The reason for this error is that a ftp server is not configured on your server.

To solve this problem, do the following steps:

(i) Install Vsftpd (Very Secure FTP Daemon) FTP Server

# yum install vsftpd

(ii) Turn On Vsftpd Service

# chkconfig vsftpd on

(iii) Start the service:

# service vsftpd start
# netstat -tulpn | grep :21

(iv) Create FTP user

# adduser -c 'FTP USER lion' -m lion
# passwd lion

(you will be prompted for a password. It will taunt you that your password is useless. You can ignore and retype your pw.)

(v) Restart the FTP:

# service vsftpd restart

(vi) Give Write Access to the wp-content and plugins folder with chmod 777

(vii) Now when you want to install or upgrade a wordpress plugin, you will be able to do so using the name and password set by you.

If you have multiple WP installations, you will get this error.

Unable to locate WordPress Content directory (wp-content).

To solve this problem, insert this code in the wp-config.php file:

if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}

6 thoughts on “WordPress VPS FTP Connection Problem

  1. Omkar

    I was suffering with this problem and the above page solved. Many thanks to you.

Leave a Reply

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