How to Fix FTP Credential Error on WordPress ?

If you have recently migrated your WordPress website to new environment or recently setup WordPress on your VPS server then you might have an issue with connection of FTP Credential. Most of the time we get error Failed to connect FTP server. In this post you will know how to Fix FTP Credential Error on WordPress.

If you having issue like below screenshot, then you may check the below fix.

"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."

How to Fix FTP Credential Error on WordPress ?

In most of the case your problem will be solved by entering below code to you wp-config.php

define('FS_METHOD','direct');

But if you are having issue like “could not create directory” error, there are two levels required to solving it. For this you must have root access to your VPS server.

1. Web Server Ownership over Directory.

To make sure that your web server has ownership over the directories, enter the below command:

chown -R www-data:www-data your-wordpress-main-directory

2. Directory Permission

To fix the permission of your WordPress directory, enter the below command.

sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

We get this kinds of error on cloud hosting like DigitalOcean, Amazon AWS, Google Cloud or other Cloud Hosting platform, which is because of permission error on your VPS.

Hope this work for you. If you have any problem please comment below.

Leave a Reply