The problem of “WordPress asking for FTP credentials on localhost” seems weird. If you are trying to install WordPress on your localhost, probably you are watching this weird thing. So in today’s blog, I will discuss the topic and we will try to solve the problem very quickly in different ways.
The example error message is: “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”
____-huh! That’s weird!
Solution 1: Add A Simple Code In config.php
The solution is quite simple. I have added a single line of code in my wp-config.php file and it is working like a charm. The problem is solved and I am having no issue after adding this simple line of code in my WordPress config.php file. Please refer the image below to understand more clearly.
But if you are having the problem is your main web hosting, you may try other methods that I have found on the internet. I am going to add them here for your future reference. Hope these will help you to solve the issue of “WordPress asking for FTP credentials on localhost”.
Solution 2: Change The Directory Permission
But you have to keep in mind that this may happen because of the permission issue in your WordPress Directory. Especially if you are using Mac, this is very common to get this error message. I would suggest changing the permission in your installation folder to “Read & Write” for everyone. There is another detailed article that can help you to fix this issue. You may check it to find the solution as well. This is a visual method without any coding.
If you are using a mac, you should go and open
applications/xampp/xamppfiles/ Then find the htdocs folder and right click in this folder. Then select Get Info and find the permissions at the bottom of the dialogue box. Then select everyone and permit Read & Write like the image below.
Changing Folder Permission by Command:
According to the StackExchange website, a user suggested the solution:
“On Mac OS X (Leopard), the Apache HTTP Server runs under the user account _ www, which belongs to the Group _www. To permit WordPress to set up wp-config.php throughout the installation, update documents throughout upgrades, and also upgrade the .htaccess file for very permalinks, offer the web server to create permission on the documents.
One way to do this is to change the owner of the WordPress directory and its components to _www. Keep the group as personnel, a group to which your individual account belongs and also give write approvals to the group.
cd /<wherever>/Sites/<thesite> sudo chown -R _www wordpress sudo chmod -R g+w wordpress
In this manner, the WordPress directory sites have a consent level of 775 as well as files have an approval level of 664. No file neither directory is world-writable.”
To know more: https://wordpress.stackexchange.com/questions/57166/ftp-credentials-on-localhost
Solution 3: Change The Directory Permission – Way 2
There is another possible solution that you may try to solve this “WordPress asking for FTP credentials on localhost” problem.
First, move to your installation folder (for example)
Now we’re going to modify your htdocs directory:
Enter your root password when prompted, then finish it out with a chmod call:
cd /Applications/XAMPP/xamppfiles/ sudo chown -R daemon htdocs sudo chmod -R g+w htdocs
For your kind information, if you would like to create a website from scratch, please visit the dedicated article about How to create a website using WordPress. We have tried to explain from the beginning for every WordPress user.