Can’t update or install WordPress plugins on localhost
I remember the first time I tried to install a plugin on a local WordPress setup — it failed immediately. The system asked for FTP server credentials, and I had no idea what to enter. I didn’t have time to dig into it, so I just kept installing plugins manually. Eventually, I needed to update WordPress itself along with WooCommerce and about a dozen other plugins on a project running on localhost. That was enough motivation to finally make one-click updates work. Here are two solutions, both tested on WordPress running under XAMPP.
Problem: WordPress on localhost asks for FTP credentials when installing or updating plugins and themes, and the update fails without them.
Solution:
Method 1: Using FS_METHOD (quick fix)
- Open
wp-config.phpand add:
define('FS_METHOD', 'direct'); - Change the owner or group of the project folder (see Method 2, Step 4).
Method 2: Using ProFTPD credentials
- Open the ProFTPD config file (the default FTP server bundled with XAMPP):
/opt/lampp/etc/proftpd.conf - Find the user and group XAMPP runs as (look for User daemon and #Group daemon):
User daemon — the username
#Group daemon — commented out by default; uncomment if needed - Find the user password (look for these lines):
# daemon gets the password "xampp"
UserPassword daemon 2TgjxA8g179G9c — the default is xampp; replace it with something custom - Change the owner or group of the project folder:
sudo chown daemon: -R project_folder — change owner
sudo chown :daemon -R project_folder — change group
sudo chown daemon:daemon -R project_folder — change both (usually one is enough) - Enter these credentials when WordPress prompts you:
Host: localhost
User: daemon
Password: xampp
Common problems and solutions
WordPress defaults to 755 for folders and 644 for files. After changing the owner, you may lose the ability to edit files.
Solution 1: Temporarily change the owner, run the update, then revert to the original owner.
Solution 2: Add your current user to the ProFTPD group. This is less clean than Solution 1 because it requires changing the default WordPress file permissions. It's easy to forget to reset them at the end of development — so proceed carefully:
- Uncomment #Group daemon in /opt/lampp/etc/proftpd.conf
- Add your Linux user to the daemon group:
id — check all groups for the current user
sudo usermod -a -G daemon username — replace username with your Linux username
id — confirm the change - Update the permissions:
find . -type d -exec chmod 775 {} + — for folders
find . -type f -exec chmod 664 {} + — for files - Important: After the project is finished, reset to WordPress-recommended permissions:
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
NOTE: Setting FS_METHOD to 'direct' tells WordPress to write files to disk without going through FTP. It's fine for local development but should never be left in a production wp-config.php — remove it before deploying.
Sources: