WordPress asking FTP credentials on localhost

WordPress asking FTP credentials on localhost

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 this blog, let’s discuss the topic and we will try to solve the problem very quickly in different ways.

To make sure we are on same page, 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”

WordPress FTP Issue

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.

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: Resolving Permission Issues in XAMPP

The solution is a combination of folder ownership and folder permissions.

A. The Apache User Account

First, you need to make the Apache webserver in XAMPP run using your own user account. This gives it access rights to everything you yourself can access, and is needed because WordPress (rather unnecessarily and annoyingly) does a file owner check as well as a permissions check when deciding if it can write files to a folder.

Open XAMPP’s Application Manager window, select Apache Web Server, and click the Configure button. When the dialogue opens, select the Open Configuration File button. This will open the Apache httpd.conf file in TextEdit or whatever your default editor is. You’ll have to accept a warning that XAMPP shows before the file will open.

In the editor, look for this block of code:

Where it says User daemon, change daemon to your own username (e.g. john).

Where it says Group daemon, change daemon to staff.

Save and close the editor, then click OK in the XAMPP dialog box that opened, then restart Apache.

B. The Folder Permissions

The above tweak may solve the problem, but not always. It’s best to adopt a “belt and braces” approach and change the permissions of your htdocs folder as well.

Open a terminal window and enter the following, to ensure that your htdocs folder is owned by your user account (change john to whatever your username is!). You’ll need to enter your password when prompted.

Now enter the following, to ensure your htdocs folder can be written to by any account:

Each of these commands may take a few seconds to run depending on how many folders and files there are in your htdocs folder.

NOTE: If you have moved your htdocs folder (easy to do by editing httpd.conf), replace the standard path with your path in the above commands.

Now go back to XAMPP’s Application Manager and restart Apache again.

C. The PHP Settings

By now you should be good to go, but there are a couple of PHP settings that will help your local WordPress sites perform better, so let’s sort them out now.

XAMPP’s php.ini file is located at /Applications/XAMPP/xamppfiles/etc/php.ini – so open this with your favourite code editor (I used BBEdit on this occasion).

Find the line that looks like this:

and change the 30 to 60.

Now find the line that looks like this:

and change the 128M to 256M. Don’t forget the M.

Now save and close the file, go back to XAMPP’s Application Manager, and restart Apache.

That’s it – your XAMPP installation should now play happily with WordPress.

Conclusion

Needless to say, don’t follow any of these tips on a web server that is serving to the public. These tips are intended only for private localhost development work behind a firewall and would leave a live server wide open to attack.

Happy Coding 🙂

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu